/* ==========================================================================
   JanSeva Assembly Civic Portal - Modern Mobile-First Civic CSS System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

:root {
  /* Brand Palette */
  --primary: #f47920;
  --primary-hover: #0a1f40;
  --secondary: #1E3E62;
  --accent-green: #4fb848;
  --accent-green-light: #E6F4EA;
  --accent-amber: #D97706;
  --accent-amber-light: #FEF3C7;
  --accent-red: #DC2626;
  --accent-red-light: #FEE2E2;
  --accent-blue: #2563EB;
  --accent-blue-light: #DBEAFE;
  
  /* Neutrals - Light Mode */
  --bg-main: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-subtle: #F8FAFC;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;
  --border-color: #E2E8F0;
  --border-focus: #0F2C59;

  /* UI System Elements */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
  --shadow-active: 0 12px 30px rgba(15, 44, 89, 0.2);
  
  --font-family: 'Inter', 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-height: 64px;
  --bottom-nav-height: 68px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Theme Overrides */
[data-theme="dark"] {
  --bg-main: #090D16;
  --bg-card: #131C2E;
  --bg-subtle: #1C283E;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border-color: #26354A;
  --border-focus: #3B82F6;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Reset & Base Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: #050B14;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Global Shell Container */
.app-viewport {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  max-height: 900px;
  background-color: var(--bg-main);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  transition: max-width var(--transition-fast), height var(--transition-fast), border-radius var(--transition-fast);
}

/* Frame Switcher Mode (Desktop Wide View vs Mobile Phone Frame) */
.app-viewport.full-width-mode {
  max-width: 100% !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
}

@media (min-width: 600px) {
  .app-viewport:not(.full-width-mode) {
    border-radius: 36px;
    border: 8px solid #1E293B;
    margin: 20px 0;
  }
}

/* Top System / Control Bar */
.top-system-bar {
  background-color: var(--primary);
  color: white;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.system-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-btn {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background var(--transition-fast);
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.role-badge {
  background-color: #00875A;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.admin-badge {
  background-color: #D97706;
}

/* Header Component */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(15, 44, 89, 0.3);
}

.header-title-container {
  display: flex;
  flex-direction: column;
}

.header-app-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
  line-height: 1.2;
}

[data-theme="dark"] .header-app-name {
  color: #60A5FA;
}

.header-location-pill {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.header-location-pill:hover {
  color: var(--primary);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background-color: var(--border-color);
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: var(--accent-red);
  border-radius: 50%;
}

/* Scrollable View Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
  padding-bottom: 80px;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-out forwards;
}

.view-section.active-view {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   VIEWS: Splash & Auth
   ========================================================================== */
.splash-container {
  min-height: calc(100vh - 50px);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-main) 100%);
}

.splash-hero-img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  object-fit: cover;
  margin: 20px 0;
}

.splash-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

[data-theme="dark"] .splash-title {
  color: #93C5FD;
}

.splash-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent-green) 100%);
  transition: width 0.1s linear;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  background-color: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

[data-theme="dark"] .btn-secondary {
  color: #93C5FD;
  border-color: #3B82F6;
}

.auth-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin: 20px 16px;
  border: 1px solid var(--border-color);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background-color: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text-main);
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 44, 89, 0.1);
}

.phone-input-group {
  display: flex;
  gap: 8px;
}

.country-code {
  width: 70px;
  text-align: center;
  font-weight: 600;
  background-color: var(--border-color);
}

.otp-box-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}

.otp-input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.otp-input:focus {
  border-color: var(--primary);
}

/* Radio Button Group (Local vs Public Visibility) */
.radio-tile-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}

.radio-tile-option {
  position: relative;
}

.radio-tile-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.radio-tile-card {
  border: 2px solid var(--border-color);
  background-color: var(--bg-subtle);
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radio-tile-option input[type="radio"]:checked + .radio-tile-card {
  border-color: var(--primary);
  background-color: rgba(15, 44, 89, 0.05);
}

[data-theme="dark"] .radio-tile-option input[type="radio"]:checked + .radio-tile-card {
  border-color: #3B82F6;
  background-color: rgba(59, 130, 246, 0.15);
}

.radio-tile-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  display: block;
}

.radio-tile-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   CITIZEN FEED & CARDS (Instagram-Style Civic Cards)
   ========================================================================== */
.feed-filter-scroll {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  white-space: nowrap;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  scrollbar-width: none;
}

.feed-filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.complaint-card {
  background-color: var(--bg-card);
  border-bottom: 8px solid var(--bg-main);
  padding: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.user-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

.locality-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.visibility-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  margin-left: 4px;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-submitted { background-color: var(--accent-blue-light); color: var(--accent-blue); }
.status-under_review { background-color: var(--accent-amber-light); color: var(--accent-amber); }
.status-approved { background-color: #E0E7FF; color: #4338CA; }
.status-assigned { background-color: #F3E8FF; color: #7E22CE; }
.status-in_progress { background-color: #FEF08A; color: #854D0E; }
.status-resolved { background-color: var(--accent-green-light); color: var(--accent-green); }
.status-rejected { background-color: var(--accent-red-light); color: var(--accent-red); }

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
  line-height: 1.3;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.card-media-box {
  width: 100%;
  max-height: 260px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
  background-color: #000;
}

.card-media-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.action-group {
  display: flex;
  gap: 16px;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}

.action-btn:hover, .action-btn.upvoted {
  color: var(--primary);
}

[data-theme="dark"] .action-btn:hover, [data-theme="dark"] .action-btn.upvoted {
  color: #60A5FA;
}

/* Official Update Post Card */
.official-update-card {
  border-left: 5px solid var(--accent-green);
  background-color: rgba(0, 135, 90, 0.04);
}

.official-badge-header {
  background: linear-gradient(90deg, #00875A 0%, #059669 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ==========================================================================
   STATUS TIMELINE STEPPER
   ========================================================================== */
.timeline-stepper {
  margin: 16px 0;
  padding: 0 8px;
}

.timeline-step {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 20px;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-step::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 30px;
  bottom: 0;
  width: 2px;
  background-color: var(--border-color);
}

.timeline-step:last-child::before {
  display: none;
}

.timeline-step.completed::before {
  background-color: var(--accent-green);
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-subtle);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 2;
}

.timeline-step.completed .step-circle {
  background-color: var(--accent-green);
  border-color: var(--accent-green);
  color: white;
}

.timeline-step.active .step-circle {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(15, 44, 89, 0.15);
}

.step-details {
  flex: 1;
}

.step-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

.step-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.step-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  background: var(--bg-subtle);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   ADMIN PORTAL DASHBOARD & MANAGEMEMT
   ========================================================================== */
.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
}

[data-theme="dark"] .metric-value {
  color: #93C5FD;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.admin-table-container {
  overflow-x: auto;
  padding: 0 16px 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.admin-table th {
  background-color: var(--bg-subtle);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.priority-tag {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}
.priority-low { background-color: #E2E8F0; color: #475569; }
.priority-medium { background-color: #FEF3C7; color: #B45309; }
.priority-high { background-color: #FFEDD5; color: #C2410C; }
.priority-emergency { background-color: #FEE2E2; color: #B91C1C; }

/* Audit History Log Item */
.audit-log-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audit-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.audit-action {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
}

/* ==========================================================================
   BOTTOM NAVIGATION BAR
   ========================================================================== */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 95;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast);
  width: 20%;
  border: none;
  background: none;
}

.nav-item i {
  font-size: 1.25rem;
}

.nav-item.active {
  color: var(--primary);
}

[data-theme="dark"] .nav-item.active {
  color: #60A5FA;
}

.create-nav-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: 0 4px 12px rgba(15, 44, 89, 0.4);
}

/* ==========================================================================
   MODALS & OVERLAYS (Camera, Location, Docs Drawer)
   ========================================================================== */
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-sheet {
  width: 100%;
  max-height: 88vh;
  background-color: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px 20px 30px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Camera Modal Box */
.camera-view-finder {
  width: 100%;
  height: 240px;
  background-color: #0F172A;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.camera-grid-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    linear-gradient(to right, rgba(255,255,255,0.1) 1px, transparent 1px) 0 0 / 33.3% 100%,
    linear-gradient(to bottom, rgba(255,255,255,0.1) 1px, transparent 1px) 0 0 / 100% 33.3%;
  pointer-events: none;
}

.shutter-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 4px solid white;
  background-color: var(--accent-red);
  cursor: pointer;
  margin: 16px auto 0;
  display: block;
}

/* Architecture & API Documentation Modal/View */
.doc-section {
  margin-bottom: 20px;
}
.doc-section h4 {
  color: var(--primary);
  margin-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 4px;
}
[data-theme="dark"] .doc-section h4 { color: #93C5FD; }
.code-block {
  background-color: #0F172A;
  color: #38BDF8;
  padding: 12px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.78rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Utility Helpers */
.hidden { display: none !important; }
.badge-count {
  background-color: var(--accent-red);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}
