/* ============================================================
   TEXANS FORM DASHBOARD - SHARED STYLES
   Brand: Deep Steel Blue #021018, Battle Red #ed0028,
          Liberty White #FFFFFF, H-Town Blue #0080c6
   ============================================================ */

:root {
  --steel-blue: #021018;
  --steel-blue-light: #0a2a3c;
  --steel-blue-mid: #061e2b;
  --battle-red: #ed0028;
  --battle-red-hover: #c7001f;
  --liberty-white: #FFFFFF;
  --htown-blue: #0080c6;
  --htown-blue-hover: #006ba3;
  --bg-page: #f0f2f5;
  --bg-card: #FFFFFF;
  --text-primary: #1a1a1a;
  --text-secondary: #5f6368;
  --text-on-dark: #FFFFFF;
  --border-light: #e0e0e0;
  --success-green: #0f9d58;
  --warning-amber: #f4b400;
  --error-red: #db4437;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--text-primary);
  background: var(--bg-page); -webkit-font-smoothing: antialiased;
}

a { color: var(--htown-blue); text-decoration: none; }
a:hover { color: var(--htown-blue-hover); text-decoration: underline; }

/* --- LOGIN --- */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--steel-blue) 0%, var(--steel-blue-light) 100%); padding: var(--space-md);
}
.login-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: var(--space-2xl); width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: var(--space-xl); }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--steel-blue); margin-top: var(--space-sm); letter-spacing: -0.3px; }
.login-logo .accent-bar { width: 40px; height: 3px; background: var(--battle-red); margin: var(--space-sm) auto 0; border-radius: 2px; }
.login-logo .subtitle { font-size: 13px; color: var(--text-secondary); margin-top: var(--space-xs); }

/* --- FORMS --- */
.form-group { margin-bottom: var(--space-md); }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-xs); text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border-light); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; color: var(--text-primary); background: var(--bg-card); transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--htown-blue); box-shadow: 0 0 0 3px rgba(0,128,198,0.15); }
.form-group input::placeholder { color: #aaa; }

/* --- BUTTONS --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background 0.2s, transform 0.1s; text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--battle-red); color: var(--liberty-white); }
.btn-primary:hover { background: var(--battle-red-hover); text-decoration: none; color: var(--liberty-white); }
.btn-secondary { background: var(--steel-blue); color: var(--liberty-white); }
.btn-secondary:hover { background: var(--steel-blue-light); text-decoration: none; color: var(--liberty-white); }
.btn-outline { background: transparent; color: var(--steel-blue); border: 1.5px solid var(--border-light); }
.btn-outline:hover { border-color: var(--steel-blue); background: rgba(2,16,24,0.04); text-decoration: none; }
.btn-htown { background: var(--htown-blue); color: var(--liberty-white); }
.btn-htown:hover { background: var(--htown-blue-hover); text-decoration: none; color: var(--liberty-white); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- TOP NAV --- */
.topnav {
  background: var(--steel-blue); padding: 0 var(--space-lg); display: flex; align-items: center;
  justify-content: space-between; height: 56px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.topnav-brand { display: flex; align-items: center; gap: var(--space-sm); color: var(--liberty-white); font-weight: 700; font-size: 16px; }
.topnav-brand .red-dot { width: 8px; height: 8px; background: var(--battle-red); border-radius: 50%; }
.topnav-actions { display: flex; align-items: center; gap: var(--space-md); }
.topnav-actions .nav-link { color: rgba(255,255,255,0.7); font-size: 13px; font-weight: 500; transition: color 0.2s; }
.topnav-actions .nav-link:hover { color: var(--liberty-white); text-decoration: none; }
.topnav-actions .nav-link.active { color: var(--liberty-white); }
.btn-logout {
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); border: 1px solid rgba(255,255,255,0.15);
  padding: 5px 14px; font-size: 12px; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-weight: 500;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); color: var(--liberty-white); }

/* --- PAGE LAYOUT --- */
.page-container { max-width: 1100px; margin: 0 auto; padding: var(--space-xl) var(--space-lg); }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-xl); flex-wrap: wrap; gap: var(--space-md); }
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--steel-blue); }

/* --- DASHBOARD CARDS --- */
.dashboard-grid { display: grid; gap: var(--space-md); }
.dash-card {
  background: var(--bg-card); border-radius: var(--radius-md); box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--border-light); padding: var(--space-lg); transition: box-shadow 0.2s, border-color 0.2s;
}
.dash-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: var(--htown-blue); }
.dash-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-md); }
.dash-card-title { font-size: 16px; font-weight: 700; color: var(--steel-blue); margin-bottom: 2px; }
.dash-card-dept { font-size: 13px; color: var(--text-secondary); }
.dash-card-stats { display: flex; gap: var(--space-xl); margin-bottom: var(--space-md); }
.stat-item { display: flex; flex-direction: column; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--steel-blue); line-height: 1.2; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); font-weight: 500; }
.dash-card-actions { display: flex; gap: var(--space-sm); padding-top: var(--space-md); border-top: 1px solid var(--border-light); flex-wrap: wrap; }

/* --- BADGES --- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-open { background: rgba(15,157,88,0.1); color: var(--success-green); }
.badge-closed { background: rgba(219,68,55,0.1); color: var(--error-red); }
.badge-synced { background: rgba(0,128,198,0.1); color: var(--htown-blue); }

/* --- ALERTS --- */
.alert { padding: var(--space-md); border-radius: var(--radius-sm); font-size: 14px; margin-bottom: var(--space-md); display: none; }
.alert-error { background: rgba(219,68,55,0.08); color: var(--error-red); border: 1px solid rgba(219,68,55,0.2); }
.alert-success { background: rgba(15,157,88,0.08); color: var(--success-green); border: 1px solid rgba(15,157,88,0.2); }
.alert-info { background: rgba(0,128,198,0.08); color: var(--htown-blue); border: 1px solid rgba(0,128,198,0.2); }

/* --- LOADING / EMPTY --- */
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--border-light); border-top-color: var(--battle-red); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { text-align: center; padding: var(--space-2xl); color: var(--text-secondary); }
.empty-state { text-align: center; padding: var(--space-2xl); color: var(--text-secondary); }
.empty-state h3 { font-size: 18px; color: var(--steel-blue); margin-bottom: var(--space-sm); }
.empty-state p { margin-bottom: var(--space-lg); }

/* --- TABLES --- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: var(--space-sm) var(--space-md); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); font-weight: 600; border-bottom: 2px solid var(--border-light); background: var(--bg-page); }
.data-table td { padding: var(--space-sm) var(--space-md); font-size: 14px; border-bottom: 1px solid var(--border-light); color: var(--text-primary); }
.data-table tr:hover td { background: rgba(0,128,198,0.03); }

/* --- TOGGLE --- */
.toggle-wrap { display: flex; align-items: center; gap: var(--space-sm); }
.toggle { position: relative; width: 44px; height: 24px; -webkit-appearance: none; appearance: none; background: #ccc; border-radius: 12px; cursor: pointer; transition: background 0.2s; border: none; outline: none; }
.toggle:checked { background: var(--success-green); }
.toggle::before { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle:checked::before { transform: translateX(20px); }
.toggle-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* --- SYNC LOG --- */
.sync-time { font-size: 12px; color: var(--text-secondary); }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .page-container { padding: var(--space-md); }
  .page-header { flex-direction: column; align-items: flex-start; }
  .dash-card-stats { flex-wrap: wrap; gap: var(--space-md); }
  .topnav { padding: 0 var(--space-md); }
}
