/* =============================================
   CFA PTO Tracker — Chick-fil-A Brand Theme
   ============================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* CFA Primary Palette */
  --cfa-red: #DD0033;
  --cfa-dark-red: #940929;
  --cfa-white: #FFFFFF;

  /* CFA Secondary Palette */
  --cfa-navy: #004F71;
  --cfa-dark-gray: #5B6770;
  --cfa-gray: #DAD7D2;
  --cfa-light-gray: #EEEDEB;

  /* CFA Tertiary Accents */
  --cfa-green: #249E6B;
  --cfa-yellow: #FFB549;
  --cfa-blue: #3EB1C8;
  --cfa-cream: #FCF7E7;

  /* Functional Tokens */
  --primary: var(--cfa-red);
  --primary-hover: var(--cfa-dark-red);
  --danger: #DC2626;
  --success: var(--cfa-green);
  --warning: var(--cfa-yellow);
  --bg: #F5F4F2;
  --card: var(--cfa-white);
  --text: #1F2937;
  --text-light: var(--cfa-dark-gray);
  --border: var(--cfa-gray);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===========================
   Login Page
   =========================== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #E8B5A8;
  background-image: url('/img/login-bg.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  padding: 1rem;
}

.login-box {
  background: var(--card);
  padding: 2.5rem 2rem 2rem;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 420px;
  border-top: 4px solid var(--cfa-red);
  position: relative;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo img {
  height: 60px;
  width: auto;
}

.login-box h1 {
  font-size: 1.375rem;
  margin-bottom: 0.25rem;
  text-align: center;
  color: var(--cfa-navy);
  font-weight: 700;
}

.login-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

/* ===========================
   App Header
   =========================== */
.app-header {
  background: var(--cfa-navy);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.header-brand img {
  height: 34px;
  width: auto;
}

.app-header h1 {
  font-size: 1.125rem;
  color: var(--cfa-white);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.header-actions span {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
}

.header-actions .btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
  font-size: 0.8125rem;
}

.header-actions .btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

/* ===========================
   Main Content
   =========================== */
.main-content {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ===========================
   Stat Cards
   =========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--cfa-red);
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 0.25rem;
  color: var(--cfa-navy);
}

/* ===========================
   Alert Banner
   =========================== */
.alert-banner {
  background: #FFF8E1;
  border: 1px solid #F5D060;
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-banner.hidden { display: none; }
.alert-banner .alert-icon { font-size: 1.25rem; }
.alert-banner .alert-actions { margin-left: auto; }
.alert-banner a { color: var(--cfa-red); font-weight: 600; text-decoration: none; }
.alert-banner a:hover { text-decoration: underline; }
.alert-dismiss {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #999;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.alert-dismiss:hover {
  color: #333;
  background: rgba(0,0,0,0.08);
}

/* ===========================
   Tabs
   =========================== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-weight: 500;
  color: var(--text-light);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-size: 0.9375rem;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--cfa-red);
  border-bottom-color: var(--cfa-red);
  font-weight: 600;
}

/* ===========================
   Tables
   =========================== */
.table-container {
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.toolbar {
  padding: 0.875rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: #FAFAF8;
  border-radius: 10px 10px 0 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--cfa-light-gray);
  font-weight: 600;
  white-space: normal;
  color: var(--cfa-navy);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 70px;
}

tr:hover { background: #FAFAF8; }
tr:last-child td { border-bottom: none; }

th.sortable { cursor: pointer; user-select: none; transition: background 0.15s; }
th.sortable:hover { background: #E2E1DE; }

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ===========================
   Badges
   =========================== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-active { background: #DCFCE7; color: #166534; }
.badge-inactive { background: #FEE2E2; color: #991B1B; }
.badge-hourly { background: #DBEAFE; color: var(--cfa-navy); }
.badge-exempt { background: #F3E8FF; color: #6B21A8; }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-approved { background: #DCFCE7; color: #166534; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-cancelled { background: #F3F4F6; color: #6B7280; }

/* Tab notification badge */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cfa-red);
  color: white;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 0.375rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}
.tab-badge.hidden { display: none; }

/* ===========================
   Notification Bell & Dropdown
   =========================== */
.notification-bell { position: relative; font-size: 1rem; }

.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--cfa-red);
  color: white;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
}
.notif-count.hidden { display: none; }

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 150;
}
.notif-dropdown.hidden { display: none; }

.notif-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--cfa-navy);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.notif-item {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text);
}
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; border-radius: 0 0 10px 10px; }
.notif-empty { color: var(--text-light); cursor: default; }
.notif-empty:hover { background: var(--card); }

/* ===========================
   Dropdown Menus
   =========================== */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 50;
  min-width: 180px;
  margin-top: 4px;
}
.dropdown-menu.hidden { display: none; }
.dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.dropdown-item:hover { background: var(--bg); }

@media (max-width: 768px) {
  .notif-dropdown { right: -60px; width: 280px; }
}
.badge[style*="cursor:pointer"]:hover { opacity: 0.7; text-decoration: underline; }

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn:hover { background: var(--bg); border-color: #B8B5AF; }

.btn-primary {
  background: var(--cfa-red);
  color: white;
  border-color: var(--cfa-red);
}

.btn-primary:hover {
  background: var(--cfa-dark-red);
  border-color: var(--cfa-dark-red);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover { background: #1E8B5E; border-color: #1E8B5E; }

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: 6px;
}

/* ===========================
   Forms
   =========================== */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--cfa-navy);
}

input[type="text"], input[type="password"], input[type="date"], input[type="number"],
select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cfa-red);
  box-shadow: 0 0 0 3px rgba(221, 0, 51, 0.08);
}

/* ===========================
   Modals
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 79, 113, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--card);
  border-radius: 12px;
  padding: 1.75rem;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--cfa-navy);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ===========================
   Upload Area
   =========================== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover {
  border-color: var(--cfa-red);
  background: rgba(221, 0, 51, 0.02);
}

.upload-area.dragover {
  border-color: var(--cfa-red);
  background: rgba(221, 0, 51, 0.04);
}

.upload-area input[type="file"] { display: none; }

/* ===========================
   Value Colors
   =========================== */
.positive { color: var(--success); font-weight: 600; }
.negative { color: var(--danger); font-weight: 600; }
.row-pto-warning { background: #FFF8E1; }
.row-pto-warning:hover { background: #FFF0C0; }

/* ===========================
   Detail Panel
   =========================== */
.detail-panel {
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-panel h2 {
  color: var(--cfa-navy);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.detail-header h2 { font-size: 1.25rem; }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-direction: column; align-items: stretch; }
  .app-header { padding: 0 1rem; height: 52px; }
  .app-header h1 { font-size: 1rem; }
  .header-brand img { height: 28px; }
  .login-box { margin: 1rem; padding: 2rem 1.5rem 1.5rem; }
  .tabs { gap: 0; }
  .tab { padding: 0.625rem 0.875rem; font-size: 0.8125rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .header-divider { display: none; }
  .stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
  }
  .stat-card .value { font-size: 1.25rem; margin-top: 0; }
  .login-container { padding: 0.5rem; }
  .login-box { padding: 1.5rem 1rem 1rem; border-radius: 10px; }
  .login-logo img { height: 48px; }
  .modal {
    max-width: 100% !important;
    max-height: 100vh;
    border-radius: 0;
    min-height: 100vh;
  }
  .modal-overlay { align-items: flex-start; }
}

/* ===========================
   Hamburger Menu (Mobile)
   =========================== */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }

  .header-actions {
    display: none;
  }

  .header-actions.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 52px;
    right: 0;
    background: var(--cfa-navy);
    padding: 1rem;
    width: 220px;
    box-shadow: -2px 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 101;
    gap: 0.5rem;
    border-bottom-left-radius: 10px;
  }

  .header-actions.mobile-open span {
    font-size: 0.8125rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
  }

  .header-actions.mobile-open .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

/* ===========================
   Touch-Friendly Buttons
   =========================== */
@media (max-width: 768px) {
  .btn { min-height: 44px; min-width: 44px; padding: 0.625rem 1rem; }
  .btn-sm { min-height: 44px; min-width: 44px; padding: 0.5rem 0.875rem; }
}

/* ===========================
   Tab Scrolling (Mobile)
   =========================== */
@media (max-width: 768px) {
  .tabs {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
}

/* ===========================
   Table → Card Layout (Mobile)
   =========================== */
@media (max-width: 768px) {
  .table-container { overflow-x: visible; }

  .responsive-table thead { display: none; }

  .responsive-table tbody tr {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .responsive-table tbody tr:hover { background: var(--card); }

  .responsive-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: none;
    gap: 0.5rem;
  }

  .responsive-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--cfa-navy);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    min-width: 80px;
  }

  .responsive-table tbody td:empty { display: none; }

  .responsive-table tbody td .text-right,
  .responsive-table tbody td.text-right { text-align: right; }

  /* Actions row — full width buttons */
  .responsive-table tbody td:last-child {
    justify-content: flex-end;
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
  }
}
