/* Modern theme for Fixsee */
/* Font stack */
:root {
  --ff-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Noto Sans JP, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";

  /* Accent palette */
  --brand-primary: #4f46e5; /* indigo-600 */
  --brand-primary-600: #4f46e5;
  --brand-primary-700: #4338ca;
  --brand-accent: #06b6d4; /* cyan-500 */

  /* Radii & shadow */
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-md: 0 12px 24px rgba(16, 24, 40, 0.08);
}

html, body {
  font-family: var(--ff-sans);
}

/* Subtle background with radial gradient */
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(79, 70, 229, 0.08), transparent 60%),
    radial-gradient(800px 400px at -10% 20%, rgba(6, 182, 212, 0.08), transparent 60%);
  -webkit-tap-highlight-color: transparent;
}

/* Navbar: translucent glassy look */
.navbar {
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* Cards */
.card {
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.card-hover:hover {
  transform: translateY(-2px);
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: var(--shadow-md);
}

/* Tables */
.table {
  --bs-table-bg: transparent;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table th, .table td {
  vertical-align: middle;
  line-height: 1.4;
}

.table thead th {
  font-weight: 600;
}

/* Text wrapping: keep natural breaks; avoid per-character breaks */
.table td { overflow-wrap: break-word; word-break: normal; }

/* Buttons & forms */
.btn {
  border-radius: 0.6rem;
}

.form-control, .form-select {
  border-radius: 0.6rem;
}

/* Footer */
.app-footer {
  margin-top: 3rem;
  padding: 1rem 0;
  color: var(--bs-secondary-color);
}

/* Brand accents */
.btn-primary {
  background-color: var(--brand-primary-600);
  border-color: var(--brand-primary-600);
}
.btn-primary:hover {
  background-color: var(--brand-primary-700);
  border-color: var(--brand-primary-700);
}

.link-accent {
  color: var(--brand-accent);
}

/* Utility: constrained content for auth/forms */
.content-narrow {
  max-width: 720px;
}

/* Dark mode tweaks */
[data-bs-theme="dark"] body {
  background: radial-gradient(1000px 500px at 80% -10%, rgba(79, 70, 229, 0.12), transparent 60%),
    radial-gradient(700px 350px at -10% 20%, rgba(6, 182, 212, 0.12), transparent 60%),
    #0b0f17;
}

[data-bs-theme="dark"] .card {
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-bs-theme="dark"] .navbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Smooth content transition for dashboard */
.fade-container {
  transition: opacity 180ms ease;
}
.fade-container.is-fading {
  opacity: 0.2;
}

/* Cycle nav chips */
.cycle-nav .nav-link {
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
}
.cycle-nav .nav-link.active {
  box-shadow: var(--shadow-sm);
}

/* Bento UI grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  align-items: stretch;
  grid-auto-flow: dense; /* try to backfill layout gaps */
}

@media (min-width: 1200px) {
  .bento-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
  }
}

.bento-card {
  height: 100%;
  border-radius: 1rem;
  border: 1px solid rgba(0,0,0,0.06);
}

[data-bs-theme="dark"] .bento-card {
  border-color: rgba(255,255,255,0.06);
}

.bento-span-2 { grid-column: 1 / -1; }

/* When there is ample room (>=1200px), use 2-column span */
@media (min-width: 1200px) {
  .bento-span-2 { grid-column: span 2; }
}

/* Subtle gradient accents for summary cards */
.card.text-bg-success {
  background: linear-gradient(135deg, rgba(25, 135, 84, 0.18), rgba(25, 135, 84, 0.06));
  color: inherit;
}
.card.text-bg-danger {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.18), rgba(220, 53, 69, 0.06));
  color: inherit;
}
.card.text-bg-warning {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.22), rgba(255, 193, 7, 0.08));
  color: inherit;
}

/* Make number blocks pop a bit */
.bento-card .display-6 {
  letter-spacing: 0.2px;
}

/* Sticky table header within card and iOS-friendly scrolling */
.table-scroll {
  max-height: 48vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Subtle edge fade to hint scroll on mobile */
@media (max-width: 576px) {
  .table-scroll {
    background:
      linear-gradient(to right, var(--bs-body-bg), rgba(0,0,0,0)) 0 0 / 16px 100% no-repeat,
      linear-gradient(to left, var(--bs-body-bg), rgba(0,0,0,0)) 100% 0 / 16px 100% no-repeat;
  }
  .table-scroll > .table { background: transparent; }
}

/* iOS safe-area paddings */
.container-xxl {
  padding-left: calc(var(--bs-gutter-x) + env(safe-area-inset-left));
  padding-right: calc(var(--bs-gutter-x) + env(safe-area-inset-right));
}

/* Stacked table layout for small screens */
/* Currently not used, but kept for future opt-in */
@media (max-width: 576px) {
  .table-stacked thead { display: none; }
  .table-stacked, .table-stacked tbody, .table-stacked tr { display: block; width: 100%; }
  .table-stacked tr {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.75rem;
    overflow: hidden;
  }
  .table-stacked td {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--bs-border-color);
  }
  .table-stacked td:last-child { border-bottom: 0; }
  .table-stacked td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--bs-secondary-color);
    flex: 0 0 7.5rem; /* label width */
    max-width: 45%;
  }
  .table-stacked .text-center { justify-content: center; }
  .table-stacked .text-end { justify-content: space-between; }
  .table-stacked .btn { flex-shrink: 0; }
}

/* Subtle mobile tweaks for legibility without stacking */
@media (max-width: 576px) {
  .table th, .table td { padding: 0.6rem 0.75rem; }
  .table { font-size: 0.95rem; }
  /* Hide low-priority columns on small screens */
  .is-sm-hidden { display: none !important; }
}
