/* ──────────────────────────────────────────────────────────────────
   Σουρίδης Office — admin layout on top of Bootstrap 5.3
   Brand: teal #1d6c73 + accent red #c53929
   ────────────────────────────────────────────────────────────────── */

:root {
  --bs-primary: #1d6c73;
  --bs-primary-rgb: 29, 108, 115;

  --souridis-teal: #1d6c73;
  --souridis-teal-dark: #155257;
  --souridis-teal-light: #e7f1f2;
  --souridis-red: #c53929;

  --sidebar-width: 260px;
  --topbar-height: 60px;
  --bg-app: #f6f8fb;
  --bg-card: #ffffff;
  --border-soft: #e5e7eb;
  --text-body: #1f2937;
  --text-muted: #6b7280;
  --text-faded: #9ca3af;
}

html, body { height: 100%; }
body {
  background: var(--bg-app);
  color: var(--text-body);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ──────────────── Bootstrap brand color overrides ──────────────── */
.btn-primary {
  --bs-btn-bg: #1d6c73;
  --bs-btn-border-color: #1d6c73;
  --bs-btn-hover-bg: #155257;
  --bs-btn-hover-border-color: #155257;
  --bs-btn-active-bg: #0f4347;
  --bs-btn-active-border-color: #0f4347;
  --bs-btn-disabled-bg: #1d6c73;
  --bs-btn-disabled-border-color: #1d6c73;
}
.btn-outline-primary {
  --bs-btn-color: #1d6c73;
  --bs-btn-border-color: #1d6c73;
  --bs-btn-hover-bg: #1d6c73;
  --bs-btn-hover-border-color: #1d6c73;
  --bs-btn-active-bg: #155257;
  --bs-btn-active-border-color: #155257;
}
a { color: var(--souridis-teal); text-decoration: none; }
a:hover { color: var(--souridis-teal-dark); text-decoration: underline; }
.text-primary { color: var(--souridis-teal) !important; }
.bg-primary { background-color: var(--souridis-teal) !important; }
.bg-primary-subtle { background-color: var(--souridis-teal-light) !important; }
.border-primary { border-color: var(--souridis-teal) !important; }
.border-primary-subtle { border-color: #cce0e2 !important; }
.text-accent { color: var(--souridis-red) !important; }
.link-primary { color: var(--souridis-teal) !important; }
.link-primary:hover { color: var(--souridis-teal-dark) !important; }

/* ──────────────── App shell: sidebar + main ──────────────── */
.app-shell {
  display: grid;
  /* minmax(0, 1fr) — όχι σκέτο 1fr — αλλιώς wide content (π.χ. tables)
     μεγαλώνει τη στήλη πέρα από το viewport και η σελίδα γίνεται blank. */
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

/* SIDEBAR ─────────────────────────────────────────────────────── */
.app-sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 1030;
}

.sidebar-brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border-soft);
  text-align: center;
}
.sidebar-brand a {
  text-decoration: none !important;
  color: inherit;
  display: inline-block;
}
.sidebar-brand a:hover { text-decoration: none !important; }
.sidebar-brand img {
  display: block;
  max-width: 100%;
  max-height: 60px;
  width: auto;
  margin: 0 auto;
}
.sidebar-brand .brand-fallback {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--souridis-teal);
  margin: 0;
  text-decoration: none;
}
.sidebar-brand .brand-fallback small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--souridis-red);
  letter-spacing: 0.04em;
  margin-top: 2px;
  text-transform: lowercase;
  text-decoration: none;
}

.sidebar-section {
  padding: 16px 14px 8px;
}
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faded);
  padding: 0 10px 8px;
  margin: 0;
}
.sidebar-section .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #4b5563;
  font-weight: 500;
  font-size: 13.5px;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: all .15s;
  text-decoration: none;
  position: relative;
}
.sidebar-section .nav-link:hover {
  background: #f3f4f6;
  color: var(--text-body);
}
.sidebar-section .nav-link i {
  font-size: 17px;
  flex-shrink: 0;
  opacity: .75;
}
.sidebar-section .nav-link.active {
  background: var(--souridis-teal-light);
  color: var(--souridis-teal);
  font-weight: 600;
}
.sidebar-section .nav-link.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--souridis-teal);
  border-radius: 0 3px 3px 0;
}
.sidebar-section .nav-link.active i { opacity: 1; }
.sidebar-section .nav-link .badge { margin-left: auto; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-soft);
  padding: 12px 14px;
}
.sidebar-footer .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 13px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
}
.sidebar-footer .nav-link:hover {
  background: #f3f4f6;
  color: var(--text-body);
}
.sidebar-footer .nav-link i { font-size: 16px; opacity: .75; }

/* MAIN ────────────────────────────────────────────────────────── */
.app-main {
  min-width: 0;            /* prevent grid overflow — paired με minmax(0,1fr) στο shell */
  display: flex;
  flex-direction: column;
  overflow-x: hidden;      /* safety net — wide tables πρέπει να scroll μέσα στο .table-responsive */
}

/* Backdrop default state: hidden σε desktop ώστε να μην παίρνει grid cell στο .app-shell. */
.sidebar-backdrop { display: none; }

/* Top bar (μόνο σε mobile εμφανίζει το hamburger) */
.app-topbar {
  display: none;
  align-items: center;
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border-soft);
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.app-topbar .topbar-brand { font-weight: 600; color: var(--souridis-teal); }
.app-topbar img { max-height: 32px; }

.app-content {
  padding: 28px 32px 60px;
  max-width: 1400px;
  width: 100%;
  flex: 1;
}

/* Page header pattern */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-soft);
}
.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--text-body);
}
.page-header .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}
.page-header .breadcrumb-link {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.page-header .breadcrumb-link:hover { color: var(--souridis-teal); }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ──────────────── Cards ──────────────── */
.card {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.card-header {
  background: #fafbfc;
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 20px;
}
.card-header h2, .card-header h3 { font-weight: 600; }

/* ──────────────── Stat cards ──────────────── */
.stat-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 18px 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--souridis-teal);
}
.stat-card.stat-success::before { background: #10b981; }
.stat-card.stat-warning::before { background: #f59e0b; }
.stat-card.stat-info::before    { background: #3b82f6; }
.stat-card.stat-danger::before  { background: #ef4444; }

.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.02em;
  color: var(--text-body);
  line-height: 1.1;
}
.stat-card.stat-success .stat-value { color: #047857; }
.stat-card.stat-warning .stat-value { color: #b45309; }
.stat-card.stat-info    .stat-value { color: #1e40af; }
.stat-card.stat-danger  .stat-value { color: #b91c1c; }

/* ──────────────── Status pills ──────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.4;
}
.status::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-pending  { background: #fef3c7; color: #92400e; }
.status-sent     { background: #dbeafe; color: #1e40af; }
.status-accepted { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-expired  { background: #e5e7eb; color: #374151; }

/* ──────────────── Tables ──────────────── */
.table {
  --bs-table-bg: transparent;
  font-size: 13.5px;
  margin-bottom: 0;
}
.table thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: #fafbfc;
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 14px;
}
.table tbody td {
  padding: 12px 14px;
  border-color: var(--border-soft);
  vertical-align: middle;
}
.table-hover tbody tr:hover { background: #fafbfd; }
.table td { font-variant-numeric: tabular-nums; }

/* Sortable */
table.sortable th[data-sort] { cursor: pointer; user-select: none; }
table.sortable th[data-sort]:hover { background: #f1f5f9; color: var(--text-body); }
table.sortable th.sort-asc::after  { content: " ▲"; color: var(--souridis-teal); font-size: 9px; }
table.sortable th.sort-desc::after { content: " ▼"; color: var(--souridis-teal); font-size: 9px; }
table.sortable .col-aa {
  width: 1%;
  text-align: right;
  white-space: nowrap;
  color: var(--text-faded);
  font-size: 12px;
}
.row-overdue td { background: #fef2f2 !important; }

/* ──────────────── Forms ──────────────── */
.form-label.fw-semibold { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600 !important; margin-bottom: 6px; }
.form-control, .form-select {
  border-color: var(--border-soft);
  font-size: 14px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--souridis-teal);
  box-shadow: 0 0 0 3px rgba(29, 108, 115, .12);
}

/* ──────────────── Excel preview ──────────────── */
.excel-preview {
  overflow: auto;
  max-height: 480px;
  border-top: 1px solid var(--border-soft);
}
.excel-preview table {
  border-collapse: collapse;
  font-size: 12px;
  font-family: "SF Mono", "Consolas", "Menlo", monospace;
  background: white;
  margin: 0;
}
.excel-preview th, .excel-preview td {
  border: 1px solid #e5e7eb;
  padding: 4px 8px;
  min-width: 80px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}
.excel-preview thead th, .excel-preview tbody th {
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  position: sticky;
  z-index: 1;
}
.excel-preview thead th { top: 0; }
.excel-preview tbody th { left: 0; min-width: 36px; }

/* ──────────────── Upload card ──────────────── */
.upload-card {
  background: linear-gradient(135deg, #f1f9fa 0%, var(--souridis-teal-light) 100%);
  border: 1px solid #cce0e2;
  border-left: 3px solid var(--souridis-teal);
}

/* ──────────────── Empty state ──────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}
.empty-state i { font-size: 56px; color: var(--text-faded); }
.empty-state h2 { font-size: 16px; font-weight: 600; margin-top: 16px; }

/* ──────────────── Login page ──────────────── */
.login-body {
  background: linear-gradient(135deg, var(--souridis-teal) 0%, var(--souridis-teal-dark) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
  width: 100%;
  max-width: 420px;
}
.login-card .login-logo {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  margin: 0 auto 24px;
}

/* ──────────────── Responsive — mobile sidebar drawer ──────────────── */
@media (max-width: 991.98px) {
  .app-shell { grid-template-columns: 1fr; }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 30px rgba(0, 0, 0, .15);
  }
  body.sidebar-open .app-sidebar { transform: translateX(0); }

  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 1029;
  }
  body.sidebar-open .sidebar-backdrop { display: block; }

  .app-topbar { display: flex; }

  .app-content { padding: 20px 16px 40px; }
}
