/* ============================================
   News India 24x7 MIS Control System
   Main Stylesheet
   ============================================ */

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --primary-dark: #0d1642;
  --success: #2e7d32;
  --success-light: #4caf50;
  --danger: #c62828;
  --danger-light: #ef5350;
  --warning: #f57f17;
  --warning-light: #ffc107;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-500: #9e9e9e;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: all 0.3s ease;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================
   Header / Navbar
   ============================================ */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
}

.navbar-brand span {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.8;
  display: block;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-user {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

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

.btn-primary:hover {
  background: var(--primary-light);
}

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

.btn-success:hover {
  background: var(--success-light);
}

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

.btn-danger:hover {
  background: var(--danger-light);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

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

.btn-white:hover {
  background: var(--gray-100);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-200);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-800);
}

/* ============================================
   Dashboard Stats
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card.success {
  border-top-color: var(--success);
}

.stat-card.danger {
  border-top-color: var(--danger);
}

.stat-card.warning {
  border-top-color: var(--warning);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-card.success .stat-value {
  color: var(--success);
}

.stat-card.danger .stat-value {
  color: var(--danger);
}

.stat-card.warning .stat-value {
  color: var(--warning);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-600);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-700);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: var(--transition);
  background: var(--white);
  color: var(--gray-900);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.15);
}

textarea.form-control {
  min-height: 150px;
  resize: vertical;
  font-family: inherit;
}

select.form-control {
  cursor: pointer;
}

/* ============================================
   Tables
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--primary);
  color: var(--white);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9rem;
  vertical-align: top;
}

tbody tr:hover {
  background: var(--gray-50);
}

tbody tr:nth-child(even) {
  background: var(--gray-50);
}

tbody tr:nth-child(even):hover {
  background: var(--gray-200);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
}

.alert-success {
  background: #e8f5e9;
  color: var(--success);
  border: 1px solid #a5d6a7;
}

.alert-danger {
  background: #ffebee;
  color: var(--danger);
  border: 1px solid #ef9a9a;
}

.alert-warning {
  background: #fff8e1;
  color: #e65100;
  border: 1px solid #ffcc80;
}

.alert-info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

/* ============================================
   Container
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.container-sm {
  max-width: 500px;
  margin: 0 auto;
  padding: 24px;
}

/* ============================================
   Login Page
   ============================================ */
.login-wrapper {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #e8eaf6, #c5cae9);
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card h2 {
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 1.5rem;
}

.login-card .subtitle {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.login-card .form-group {
  text-align: left;
}

.login-card .btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  margin-top: 8px;
}

/* ============================================
   Home / Landing
   ============================================ */
.hero {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 32px;
  max-width: 500px;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-buttons .btn {
  padding: 14px 32px;
  font-size: 1rem;
}

/* ============================================
   Filters Bar
   ============================================ */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filters-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

.filters-bar .btn {
  flex-shrink: 0;
}

/* ============================================
   Badge
   ============================================ */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-active {
  background: #e8f5e9;
  color: var(--success);
}

.badge-inactive {
  background: #ffebee;
  color: var(--danger);
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  color: var(--primary);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--gray-200);
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-600);
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

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

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination .btn {
  min-width: 40px;
}

/* ============================================
   Loading
   ============================================ */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-500);
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
}

.empty-state h3 {
  color: var(--gray-600);
  margin-bottom: 8px;
}

/* ============================================
   Report Text
   ============================================ */
.report-text {
  max-width: 400px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  text-align: center;
  padding: 16px;
  color: var(--gray-500);
  font-size: 0.8rem;
  border-top: 1px solid var(--gray-200);
  margin-top: 40px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .navbar {
    padding: 0 16px;
    height: 56px;
  }

  .navbar-brand {
    font-size: 1rem;
  }

  .container {
    padding: 16px;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 2rem;
  }

  .filters-bar {
    flex-direction: column;
  }

  .filters-bar .form-group {
    width: 100%;
  }

  .login-card {
    padding: 24px;
  }

  .modal {
    padding: 20px;
  }

  .tabs {
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .hero-buttons .btn {
    width: 100%;
  }
}

/* ============================================
   Utility
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.hidden { display: none !important; }
