/* public/assets/css/main.css */

/* =========================================================
   Theme
   ========================================================= */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(226, 232, 240, 0.9);

  --primary: #0d6efd;
  --secondary: #6c757d;

  --sidebar-bg: #0f172a;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;

  --shadow: 0 10px 20px rgba(2, 6, 23, 0.06);

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --sidebar-width: 270px;
}

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* =========================================================
   Guest Layout
   ========================================================= */
body.guest { display: block; }

.guest-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.guest-card {
  width: 100%;
  max-width: 520px;
}

/* =========================================================
   App Layout
   ========================================================= */
body.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);

  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;

  padding: 22px;

  transform: translateX(calc(var(--sidebar-width) * -1));
  transition: transform 0.25s ease;

  z-index: 1200;
}

body.sidebar-open .app-sidebar { transform: translateX(0); }

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 14px 4px;
}

.app-brand__logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255,255,255,0.10);
  display: grid;
  place-items: center;
}

.app-brand__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-brand__name {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

/* Nav */
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.app-nav__link {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 11px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;

  color: var(--sidebar-muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.app-nav__link i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.app-nav__link:hover {
  background: rgba(255,255,255,0.08);
  color: var(--sidebar-text);
}

.app-nav__link.is-active {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}

.app-nav__divider {
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 10px 8px;
  border-radius: 999px;
}

.app-nav__link.is-danger { color: #fecaca; }

.app-nav__link.is-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #ffffff;
}

/* Backdrop */
.app-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1100;
}

body.sidebar-open .app-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Shell */
.app-shell {
  width: 100%;
  margin-left: 0;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;

  background: var(--surface);
  border-bottom: 1px solid var(--border);

  padding: 14px 22px;

  display: flex;
  align-items: center;
  gap: 14px;
}

.app-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;

  border: 1px solid var(--border);
  background: #ffffff;

  display: grid;
  place-items: center;

  box-shadow: 0 6px 16px rgba(2, 6, 23, 0.05);
}

.app-icon-btn i {
  font-size: 1.25rem;
  color: var(--text);
}

.app-header__title {
  font-weight: 700;
  color: var(--text);
}

.app-header__name { color: var(--primary); }

/* Content */
.app-content {
  padding: 26px 22px;
  flex: 1;
}

/* Footer */
.app-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 22px;

  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* =========================================================
   Components
   ========================================================= */
.fin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* Buttons */
.btn-fin-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #ffffff;

  border-radius: 12px;
  padding: 10px 16px;

  transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-fin-primary:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
  box-shadow: 0 12px 18px rgba(2, 6, 23, 0.10);
  color: #ffffff;
}

/* Bootstrap overrides */
.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.btn-secondary {
  background-color: var(--secondary) !important;
  border-color: var(--secondary) !important;
}

.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.bg-secondary { background-color: var(--secondary) !important; }

/* Optional utility */
.btn-white {
  background: #fff !important;
  color: var(--text) !important;
}

/* Table header (if used) */
.table thead th {
  background: var(--sidebar-bg) !important;
  color: #ffffff !important;
  border-bottom: none !important;
  padding: 12px 14px;
}

/* =========================================================
   Lightbox
   ========================================================= */
.app-lightbox {
  position: fixed;
  inset: 0;

  display: none;
  align-items: center;
  justify-content: center;

  background: rgba(2, 6, 23, 0.92);
  z-index: 3000;
}

.app-lightbox.is-open { display: flex; }

.app-lightbox__controls{
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 10px;
}

.app-lightbox__btn{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: #ffffff;

  display: grid;
  place-items: center;

  box-shadow: 0 12px 18px rgba(0,0,0,0.25);
  text-decoration: none;
  color: var(--text);
}

.app-lightbox__btn:hover{
  filter: brightness(0.98);
  color: var(--text);
}

.app-lightbox__inner { padding: 14px; }

.app-lightbox__inner img {
  max-height: 88vh;
  max-width: 92vw;

  border-radius: var(--radius-lg);
  border: 5px solid #ffffff;
}

/* =========================================================
   Desktop behavior
   ========================================================= */
@media (min-width: 992px) {
  .app-backdrop { display: none; }
  .app-sidebar { transform: translateX(0); }
  .app-shell { margin-left: var(--sidebar-width); }
}

/* =========================================================
   Auth / Login
   ========================================================= */
.auth-card {
  border-radius: 20px;
  padding: 24px;
  border: 0;
}

.auth-header {
  text-align: center;
  margin-bottom: 18px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  overflow: hidden;
  margin: 0 auto 10px auto;
  background: rgba(0,0,0,0.06);
}

.auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-title {
  font-weight: 800;
  margin: 0 0 6px 0;
  color: var(--text);
}

.auth-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

.auth-input {
  background: rgba(2, 6, 23, 0.04);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  padding: 14px 14px;
  color: var(--text);
}

.auth-input:focus {
  border-color: rgba(13, 110, 253, 0.45);
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
  background: rgba(2, 6, 23, 0.03);
}

.auth-input--left {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.auth-eye-btn {
  background: rgba(2, 6, 23, 0.04);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-left: 0;
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
  padding: 0 14px;
  color: var(--text);
}

/* =========================================================
   Page Header + Sections
   ========================================================= */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-title {
  margin: 0;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-subtitle {
  margin: 6px 0 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.icon-back {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;

  display: grid;
  place-items: center;

  box-shadow: 0 8px 16px rgba(2, 6, 23, 0.06);
  color: var(--text);
  text-decoration: none;
}

.icon-back:hover { filter: brightness(0.98); }

.section-head { margin-bottom: 12px; }

.section-title {
  font-weight: 900;
  color: var(--text);
}

.section-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* =========================================================
   Travel Form / View (shared)
   ========================================================= */
.duration-box{
  background: rgba(13,110,253,.10);
  border: 1px solid rgba(13,110,253,.20);
  border-radius: 16px;
  padding: 14px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.duration-box__label{
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.duration-box__value{
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--primary);
}

.file-drop{
  border: 1px dashed rgba(148,163,184,.9);
  border-radius: 16px;
  padding: 14px;
  background: rgba(2,6,23,.02);
}

/* Thumbnails (gallery) */
.thumb-grid{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.thumb-card{
  width: 86px;
  height: 86px;
  border-radius: 16px;
  overflow:hidden;
  border: 1px solid rgba(226,232,240,.95);
  background:#fff;
  box-shadow: 0 10px 16px rgba(2,6,23,.06);
  position: relative;
}

.thumb-card img{
  width:100%;
  height:100%;
  object-fit:cover;
  cursor: pointer;
}

.thumb-card__remove{
  position:absolute;
  top:6px;
  right:6px;
}

.thumb-remove-btn{
  width:26px;
  height:26px;
  border-radius:999px;
  border: 2px solid #fff;
  background: rgba(239,68,68,.95);
  color:#fff;
  display:grid;
  place-items:center;
  padding:0;
}

.thumb-remove-btn i{ font-size: 1rem; }

.money-pill{
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(25,135,84,.10);
  border: 1px solid rgba(25,135,84,.20);
  color: #198754;
  font-weight: 900;
  font-size: 1.25rem;
}

.note-box{
  background: rgba(2,6,23,.03);
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 16px;
  padding: 14px;
  line-height: 1.6;
  min-height: 120px;
}

/* =========================================================
   UI Label / Value (universal)
   ========================================================= */
.ui-label{
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.ui-value{
  font-weight: 800;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.25;
}

/* =========================================================
   Filter Bar
   ========================================================= */
.filter-bar { --control-h: 46px; }

.filter-group .filter-addon{
  height: var(--control-h);
  border-radius: 14px 0 0 14px;
  border: 1px solid var(--border);
  border-right: 0;
  background: rgba(2, 6, 23, 0.03);
  color: var(--muted);
}

.filter-control{
  height: var(--control-h);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.03);
  color: var(--text);
}

.filter-control:focus{
  border-color: rgba(13, 110, 253, 0.45);
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
  background: rgba(2, 6, 23, 0.02);
}

.filter-control--input{
  border-radius: 0 14px 14px 0;
  border-left: 0;
}

.filter-meta{
  font-size: 0.9rem;
  color: var(--muted);
}

.filter-meta__pill{
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.10);
  color: var(--primary);
  font-weight: 900;
  margin-left: 6px;
}

.filter-actions{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
}

.filter-actions .btn{
  height: var(--control-h);
  border-radius: 14px;
  font-weight: 900;
  flex: 1;
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-reset-btn{
  background: rgba(2, 6, 23, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.55);
  color: var(--text);
}

.filter-reset-btn:hover{ filter: brightness(0.98); }

@media (max-width: 420px){
  .filter-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .filter-actions .btn{
    width: 100%;
    min-width: 0;
  }
}

/* =========================================================
   Universal Record Cards
   ========================================================= */
.record-list{
  display: grid;
  gap: 14px;
}

.record-card{
  padding: 14px;
  border-radius: var(--radius-lg);
}

.record-top{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.record-title{
  font-weight: 900;
  font-size: 1.08rem;
  color: var(--text);
  line-height: 1.2;
}

.record-total{
  text-align: right;
  min-width: 120px;
}

.record-total__value{
  font-weight: 900;
  color: var(--primary);
  font-size: 1.05rem;
  line-height: 1.2;
}

.record-block{ min-width: 0; }

.record-fields{
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.record-field{
  padding: 0;
  border: 0;
  background: transparent;
}

@media (max-width: 768px){
  .record-fields{
    grid-template-columns: 1fr;
  }
}

.record-photos{
  margin-top: 12px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.record-photos::-webkit-scrollbar{ height: 6px; }
.record-photos::-webkit-scrollbar-thumb{
  background: rgba(148,163,184,.6);
  border-radius: 999px;
}

.record-photo{
  border: 0;
  background: transparent;
  padding: 0;
  scroll-snap-align: start;
  cursor: pointer;
}

.record-photo img{
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(226,232,240,.95);
  box-shadow: 0 10px 16px rgba(2,6,23,.06);
}

.record-card__actions{
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: stretch;
}

.record-form{ margin: 0; }

.record-btn{
  width: 100%;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 900;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 0 12px;
  white-space: nowrap;
}

.record-btn:hover{ filter: brightness(.98); }

.record-btn--view{
  background: rgba(13,110,253,.12);
  border-color: rgba(13,110,253,.25);
  color: #0d6efd;
}

.record-btn--edit{
  background: rgba(79,70,229,.12);
  border-color: rgba(79,70,229,.25);
  color: #4f46e5;
}

.record-btn--danger{
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.25);
  color: #ef4444;
}

.record-btn--view:hover,
.record-btn--edit:hover,
.record-btn--danger:hover{
  filter: brightness(0.97);
}

@media (max-width: 420px){
  .record-card__actions{
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Missing shared components (used in Travel/Event/Purchase views)
   ========================================================= */

/* Simple info block (used in view pages) */
.info-block{
  display:flex;
  gap:10px;
  align-items:flex-start;
  background: rgba(2, 6, 23, 0.03);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  padding: 14px;
  color: var(--text);
}

.info-block__title{ font-weight: 900; }
.info-block__hint{
  color: var(--muted);
  font-size: .9rem;
  margin-top: 2px;
}

/* Empty state (used in view pages) */
.dash-empty{
  padding: 28px 10px;
  text-align: center;
  color: var(--muted);
}
.dash-empty i{
  font-size: 2.2rem;
  display: block;
  margin-bottom: 8px;
  opacity: 0.6;
}

/* Optional (some older views use this) */
.border-dashed{
  border: 1px dashed rgba(148,163,184,.9) !important;
}

/* Optional helper */
.cursor-zoom-in{ cursor: zoom-in; }