/* ============================================================
   RTI Tracker — Main Stylesheet
   Design: Clean Indian Government + Modern SaaS aesthetic
   ============================================================ */

:root {
  --saffron: #FF6B35; --saffron-light: #FF8C5A; --saffron-pale: #FFF0EA;
  --green: #138808; --green-light: #1DAD0A; --green-pale: #E8F5E3;
  --navy: #0A1628; --navy-mid: #1A2940; --navy-light: #2A3F5A;
  --gold: #F4A300; --red: #D32F2F;
  --white: #FAFBFF; --gray-100: #F2F4F8; --gray-200: #E4E8EF;
  --gray-400: #9AA5B4; --gray-600: #5A6A7A;
  --shadow-sm: 0 2px 8px rgba(10,22,40,0.08);
  --shadow-md: 0 8px 24px rgba(10,22,40,0.12);
  --shadow-lg: 0 20px 60px rgba(10,22,40,0.18);
  --radius: 16px; --radius-sm: 10px;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Sora','Noto Sans Tamil',sans-serif; background: var(--gray-100); color: var(--navy); }
a { color: inherit; }

/* ── Auth Screen ─────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  width: 100%; max-width: 440px; background: white;
  border-radius: 24px; padding: 44px 40px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.logo-icon-large {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  border-radius: 18px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 32px; margin-bottom: 12px; box-shadow: 0 8px 24px rgba(255,107,53,0.3);
}
.auth-logo h2 { font-size: 22px; font-weight: 700; }
.auth-logo p { font-size: 13px; color: var(--gray-400); margin-top: 4px; font-family: 'Noto Sans Tamil',sans-serif; }

/* ── App Layout ──────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width); background: var(--navy);
  display: flex; flex-direction: column; min-height: 100vh;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo { padding: 24px 24px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 44px; height: 44px; background: linear-gradient(135deg, var(--saffron), var(--gold));
  border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.logo-text strong { display: block; font-size: 18px; font-weight: 700; color: white; }
.logo-text span { font-size: 11px; color: rgba(255,255,255,0.5); letter-spacing: 1px; }
.sidebar-user {
  padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 14px;
}
.avatar {
  width: 40px; height: 40px; background: linear-gradient(135deg, var(--saffron), var(--gold));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: white; flex-shrink: 0;
}
.user-info strong { display: block; font-size: 14px; font-weight: 600; color: white; }
.user-info span { font-size: 12px; color: rgba(255,255,255,0.45); }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3); padding: 12px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: var(--radius-sm); cursor: pointer; color: rgba(255,255,255,0.6);
  font-size: 14px; font-weight: 500; transition: all 0.2s; margin-bottom: 2px;
  text-decoration: none; width: 100%;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(255,107,53,0.25), rgba(255,107,53,0.1));
  color: white; border: 1px solid rgba(255,107,53,0.3);
}
.nav-icon { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-bottom { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.08); }

/* ── Main Content ────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; }
.topbar {
  background: white; padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 0 var(--gray-200); position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title h1 { font-size: 20px; font-weight: 700; }
.topbar-title p { font-size: 13px; color: var(--gray-400); margin-top: 2px; font-family: 'Noto Sans Tamil',sans-serif; }
.page-content { padding: 28px 32px; flex: 1; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--gray-600); margin-bottom: 7px;
}
.form-label .ta { font-family: 'Noto Sans Tamil',sans-serif; font-size: 11px; opacity: 0.7; margin-left: 4px; }
.required { color: var(--red); margin-left: 3px; }
.form-input {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; color: var(--navy); background: white;
  transition: all 0.2s; outline: none;
}
.form-input:focus { border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(255,107,53,0.12); }
.form-input.is-error { border-color: var(--red); }
.field-error { font-size: 12px; color: var(--red); margin-top: 4px; display: block; }
.input-group { display: flex; gap: 10px; }
.input-group .form-input { flex: 1; }
.checkbox-group { display: flex; gap: 20px; flex-wrap: wrap; padding: 4px 0; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.upload-form { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
.upload-form .full { grid-column: 1 / -1; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; background: linear-gradient(135deg, var(--saffron), var(--saffron-light));
  color: white; border: none; border-radius: 50px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.3s;
  box-shadow: 0 6px 20px rgba(255,107,53,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(255,107,53,0.45); }
.btn-full {
  width: 100%; padding: 15px; background: linear-gradient(135deg, var(--saffron), var(--saffron-light));
  color: white; border: none; border-radius: var(--radius-sm); font-size: 16px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all 0.3s; margin-top: 8px;
  box-shadow: 0 6px 20px rgba(255,107,53,0.35);
}
.btn-full:hover { transform: translateY(-1px); }
.btn-green {
  padding: 14px 28px; background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white; border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
  box-shadow: 0 6px 20px rgba(19,136,8,0.3);
}
.btn-green:hover { transform: translateY(-1px); }
.btn-otp {
  padding: 13px 20px; background: var(--navy); color: white; border: none;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.2s; white-space: nowrap;
}
.btn-otp:hover { background: var(--navy-light); }
.btn-sm { padding: 7px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s; border: none; }
.btn-sm-primary { background: var(--saffron-pale); color: var(--saffron); }
.btn-sm-primary:hover { background: var(--saffron); color: white; }
.btn-sm-danger { background: #FFEBEE; color: var(--red); }
.btn-sm-danger:hover { background: var(--red); color: white; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-title .ta { display: block; font-family: 'Noto Sans Tamil',sans-serif; font-size: 12px; font-weight: 400; color: var(--gray-400); }
.card-body { padding: 20px 24px; }

/* ── Stats Grid ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 24px;
  display: flex; align-items: flex-start; gap: 16px; box-shadow: var(--shadow-sm);
  transition: all 0.2s; border: 1.5px solid transparent;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--gray-200); }
.stat-card-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.stat-card-body strong { display: block; font-size: 28px; font-weight: 800; line-height: 1; }
.stat-card-body p { font-size: 13px; color: var(--gray-400); margin-top: 4px; }
.stat-card-body .ta { display: block; font-family: 'Noto Sans Tamil',sans-serif; font-size: 11px; color: var(--gray-400); }

/* ── Dashboard Grid ──────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

/* ── RTI Items ───────────────────────────────────────────── */
.rti-item { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--gray-100); cursor: pointer; transition: all 0.15s; }
.rti-item:last-child { border-bottom: none; }
.rti-item:hover { transform: translateX(4px); }
.rti-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.rti-body { flex: 1; min-width: 0; }
.rti-body strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rti-body span { font-size: 12px; color: var(--gray-400); font-family: 'JetBrains Mono',monospace; }
.rti-status { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.status-pending  { background: #FFF3E0; color: #E65100; }
.status-overdue  { background: #FFEBEE; color: var(--red); }
.status-replied  { background: var(--green-pale); color: var(--green); }
.status-appeal_1, .status-appeal_2 { background: #EDE7F6; color: #4527A0; }
.status-closed   { background: var(--gray-100); color: var(--gray-400); }

/* ── Reminder Items ──────────────────────────────────────── */
.reminder-item { display: flex; align-items: flex-start; gap: 14px; padding: 14px; background: var(--gray-100); border-radius: var(--radius-sm); margin-bottom: 10px; }
.reminder-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }
.reminder-body strong { font-size: 13px; font-weight: 600; }
.reminder-body p { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.reminder-days { margin-left: auto; font-size: 13px; font-weight: 700; flex-shrink: 0; }

/* ── Docs Grid ───────────────────────────────────────────── */
.docs-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.docs-search { flex: 1; min-width: 200px; padding: 11px 16px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; outline: none; }
.docs-search:focus { border-color: var(--saffron); }
.docs-filter { padding: 11px 16px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: white; cursor: pointer; outline: none; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 16px; }
.doc-card { background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); border: 1.5px solid var(--gray-100); transition: all 0.2s; cursor: pointer; }
.doc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--saffron); }
.doc-card-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.doc-type-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; background: #FFEBEE; }
.doc-card-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.doc-card-num { font-size: 12px; color: var(--gray-400); font-family: 'JetBrains Mono',monospace; margin-top: 3px; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.doc-tag { padding: 4px 10px; background: var(--gray-100); border-radius: 6px; font-size: 12px; color: var(--gray-600); }
.doc-dates { display: flex; flex-direction: column; gap: 6px; }
.doc-date-row { display: flex; justify-content: space-between; font-size: 12px; }
.doc-date-label { color: var(--gray-400); }
.doc-date-val { font-weight: 600; font-family: 'JetBrains Mono',monospace; }
.doc-date-val.urgent { color: var(--red); }
.doc-date-val.soon { color: var(--gold); }
.doc-card-footer { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--gray-100); }

/* ── Timeline ────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.tl-item { position: relative; padding: 0 0 24px 24px; }
.tl-dot { position: absolute; left: -24px; top: 3px; width: 18px; height: 18px; border-radius: 50%; border: 3px solid white; box-shadow: 0 0 0 2px var(--gray-200); background: white; }
.tl-item.done .tl-dot { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.tl-item.active .tl-dot { background: var(--saffron); box-shadow: 0 0 0 2px var(--saffron); animation: tl-pulse 1.5s infinite; }
.tl-item.upcoming .tl-dot { background: var(--gray-200); }
.tl-date { font-size: 11px; color: var(--gray-400); font-family: 'JetBrains Mono',monospace; margin-bottom: 3px; }
.tl-title { font-size: 14px; font-weight: 600; }
.tl-desc { font-size: 12px; color: var(--gray-400); margin-top: 3px; }

/* ── Admin Table ─────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--gray-400); border-bottom: 1.5px solid var(--gray-200); }
.admin-table td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--gray-100); }
.admin-table tr:hover td { background: var(--gray-100); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--green-pale); color: var(--green); border: 1px solid rgba(19,136,8,0.2); }
.alert-error { background: #FFEBEE; color: var(--red); border: 1px solid rgba(211,47,47,0.2); }
.alert-warning { background: #FFF3E0; color: #E65100; border: 1px solid rgba(230,81,0,0.2); }

/* ── Auth Tabs ───────────────────────────────────────────── */
.auth-tabs { display: flex; gap: 4px; background: var(--gray-100); border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 10px; border: none; background: none; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--gray-400); transition: all 0.2s; }
.auth-tab.active { background: white; color: var(--navy); box-shadow: var(--shadow-sm); }

/* ── Upload Area ─────────────────────────────────────────── */
.upload-area { border: 2px dashed var(--gray-200); border-radius: var(--radius); padding: 48px 24px; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--gray-100); }
.upload-area:hover, .upload-area.drag-over { border-color: var(--saffron); background: var(--saffron-pale); }
.upload-icon { font-size: 48px; margin-bottom: 16px; }
.upload-area h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.upload-area p { font-size: 13px; color: var(--gray-400); }
.file-preview { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--green-pale); border-radius: var(--radius-sm); border: 1.5px solid rgba(19,136,8,0.2); margin-top: 12px; }
.file-preview span { font-size: 14px; font-weight: 500; color: var(--green); }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 14px 20px; background: var(--navy); color: white; border-radius: 12px; font-size: 14px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease; min-width: 260px; max-width: 380px; }
.toast.success { background: var(--green); }
.toast.warning { background: var(--gold); color: var(--navy); }
.toast.error { background: var(--red); }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--gray-400); }

/* ── Mobile ──────────────────────────────────────────────── */
.menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; padding: 8px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .upload-form { grid-template-columns: 1fr; }
  .upload-form .full { grid-column: 1; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .menu-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .docs-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes tl-pulse { 0%,100% { box-shadow: 0 0 0 2px var(--saffron); } 50% { box-shadow: 0 0 0 5px rgba(255,107,53,0.3); } }

/* ── SVG Icon Images ─────────────────────────────────────── */
.logo-icon-img {
  width: 44px; height: 44px; border-radius: 12px;
  flex-shrink: 0;
}
.nav-icon-img {
  width: 20px; height: 20px; flex-shrink: 0;
  opacity: 0.6; filter: invert(1);
  transition: opacity 0.2s;
}
.nav-item:hover .nav-icon-img,
.nav-item.active .nav-icon-img {
  opacity: 1;
}
.nav-item.active .nav-icon-img {
  filter: invert(1) sepia(1) saturate(5) hue-rotate(340deg);
}
.doc-icon-img {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
}
.status-icon {
  width: 20px; height: 20px; flex-shrink: 0;
}
.btn-icon-img {
  width: 16px; height: 16px; opacity: 0.8;
}

/* ── Upload area icon ─────────────────────────────────────── */
.upload-icon-img {
  width: 56px; height: 56px; opacity: 0.5; margin-bottom: 12px;
}

/* ── India flag strip ─────────────────────────────────────── */
.india-strip {
  display: flex; gap: 0; width: 100%; height: 4px; margin-bottom: 32px;
}
.india-strip-saffron { flex: 1; background: #FF9933; border-radius: 2px 0 0 2px; }
.india-strip-white   { flex: 1; background: rgba(255,255,255,0.4); }
.india-strip-green   { flex: 1; background: #138808; border-radius: 0 2px 2px 0; }

/* ── Toast icon ─────────────────────────────────────────── */
.toast-icon { width: 18px; height: 18px; filter: invert(1); flex-shrink: 0; }

/* ── WhatsApp Toggle ─────────────────────────────────────── */
.whatsapp-toggle { display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: #E7F6E9; border-radius: var(--radius-sm); margin-bottom: 20px; border: 1.5px solid rgba(19,136,8,0.2); }
.toggle-switch { width: 48px; height: 26px; background: var(--green); border-radius: 13px; position: relative; cursor: pointer; }
.toggle-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: transform 0.2s; }
.toggle-switch.on::after { transform: translateX(22px); }

/* ── Chart Bars ──────────────────────────────────────────── */
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 120px; margin-top: 8px; }
.chart-bar { flex: 1; background: linear-gradient(180deg, var(--saffron), var(--gold)); border-radius: 6px 6px 0 0; min-height: 20px; transition: all 0.3s; cursor: pointer; opacity: 0.8; }
.chart-bar:hover { opacity: 1; transform: scaleY(1.05); transform-origin: bottom; }
.chart-labels { display: flex; gap: 12px; margin-top: 8px; }
.chart-label { flex: 1; text-align: center; font-size: 11px; color: var(--gray-400); }
