/* ===================================
   LOGIN PAGE STYLES
=================================== */
body {
  font-family: 'Inter', sans-serif;
  background-color: #ffffff;
  color: #333333;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-container {
  background: #ffffff;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: #007bff;
}

.logo {
  margin-bottom: 2rem;
}

.logo img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
  border: 1px solid #e0e0e0;
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #007bff;
  margin: 0 0 0.5rem 0;
}

.logo p {
  color: #666666;
  font-size: 0.9rem;
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333333;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background-color: #ffffff;
  color: #333333;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.form-group input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
  background-color: #ffffff;
}

.login-btn {
  background: #007bff;
  color: #ffffff;
  border: none;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,123,255,0.2);
  margin-top: 1rem;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-btn:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,123,255,0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  border: 1px solid #f5c6cb;
  display: none;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  border: 1px solid #c3e6cb;
  display: none;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #cccccc;
  border-radius: 50%;
  border-top-color: #007bff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.credentials-info {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 10px;
  margin-top: 1.5rem;
  border: 1px solid #e0e0e0;
}

.credentials-info h3 {
  margin: 0 0 0.75rem 0;
  color: #007bff;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.credentials-info p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: #666666;
}

.credentials-info strong {
  color: #007bff;
}

/* ===================================
   RESET & BASE STYLES
=================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

img, svg {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  outline: none;
  border: none;
  font-family: inherit;
}

/* ===================================
   UTILITY CLASSES
=================================== */
.logo-img {
  width: 32px;
  height: 32px;
  margin-right: 8px;
}

.hidden {
  display: none !important;
}

/* ===================================
   LAYOUT
=================================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 0.75rem 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 2px solid rgba(255,255,255,0.1);
}

.topbar .brand {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
}

.topbar .controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar .controls select,
.topbar .controls button {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background-color: rgba(255,255,255,0.1);
  color: #ffffff;
  transition: all 0.3s ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.topbar .controls select:hover,
.topbar .controls button:hover {
  background-color: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.topbar .controls button.icon-btn {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topbar .controls button.icon-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ===================================
   KPI CARDS
=================================== */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kpi.card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 16px;
  padding: 1.5rem 1.2rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  transition: all 0.4s ease;
  border: 1px solid rgba(255,255,255,0.8);
  position: relative;
  overflow: hidden;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.kpi.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px 16px 0 0;
}

.kpi.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 35px rgba(0,0,0,0.15);
}

.kpi-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: #6c757d;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kpi-title::before {
  content: '📊';
  font-size: 1rem;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: #007bff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: valueGlow 2s ease-out;
}

@keyframes valueGlow {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===================================
   WEEKLY COMPARISON CARD
=================================== */
#kpiWeeklyComparison {
  font-size: 0.05rem;
  line-height: 0.7;
  white-space: pre-line;
}

/* ===================================
   SPECIAL EVENTS
=================================== */
.special-events-list {
  margin-bottom: 2rem;
}

.special-events-list h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #333333;
}

.special-events-list h4::before {
  content: '🎪';
  font-size: 1.2rem;
}

#specialEventsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.event-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem 1.2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid #e0e0e0;
  position: relative;
  overflow: hidden;
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.event-card:nth-child(1) { border-top: 4px solid #007bff; }
.event-card:nth-child(2) { border-top: 4px solid #28a745; }
.event-card:nth-child(3) { border-top: 4px solid #007bff; }
.event-card:nth-child(4) { border-top: 4px solid #28a745; }
.event-card:nth-child(5) { border-top: 4px solid #007bff; }
.event-card:nth-child(6) { border-top: 4px solid #28a745; }

.event-title {
  font-weight: 700;
  font-size: 1rem;
  color: #333333;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.3;
}

.event-title::before {
  content: '📅';
  font-size: 1.1rem;
}

.event-count {
  font-size: 2rem;
  font-weight: 900;
  color: #007bff;
  text-align: center;
  animation: countUp 2s ease-out;
}

@keyframes countUp {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===================================
   CHART CARDS
=================================== */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
}

.chart-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333333;
}

.chart-card canvas {
  width: 100% !important;
  height: 300px !important;
}

/* ===================================
   TABLES
=================================== */
.tables {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.table-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
}

.table-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333333;
}

.table-card input {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid #cccccc;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background-color: #ffffff;
  color: #333333;
  transition: all 0.3s ease;
}

.table-card input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  background: #f8f9fa;
  color: #333333;
}

th, td {
  padding: 0.65rem 0.5rem;
  text-align: left;
  font-size: 0.9rem;
  border-bottom: 1px solid #e0e0e0;
  color: #333333;
}

tr:hover {
  background-color: #f8f9fa;
  transition: background-color 0.3s ease;
}

/* ===================================
   MODALS
=================================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 1rem;
  overflow-y: auto;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  animation: fadeIn 0.3s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  border: 1px solid #e0e0e0;
}

.modal-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333333;
}

.modal-content label {
  display: block;
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
  color: #333333;
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 0.5rem 0.55rem;
  margin-top: 0.25rem;
  border-radius: 8px;
  border: 1px solid #cccccc;
  font-size: 0.9rem;
  background-color: #ffffff;
  color: #333333;
  transition: all 0.3s ease;
}

.modal-content input:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.modal-content textarea {
  resize: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.modal-actions button {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid #007bff;
  background-color: #007bff;
  color: #ffffff;
  font-weight: 500;
  transition: all 0.3s ease;
}

.modal-actions button:hover {
  background-color: #ffffff;
  color: #007bff;
  box-shadow: 0 2px 8px rgba(0,123,255,0.2);
}

/* ===================================
   BUTTONS
=================================== */
button {
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
}

/* ===================================
   RESPONSIVE MEDIA QUERIES
=================================== */
@media screen and (max-width: 1024px) {
  .topbar {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
  }
  .charts {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 0 0.5rem;
  }
  .kpis {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media screen and (max-width: 768px) {
  .kpis {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
  }
  .topbar .controls {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .charts {
    gap: 1rem;
  }
  .chart-card {
    padding: 0.75rem;
  }
  .chart-card canvas {
    height: 250px !important;
  }
  .tables {
    gap: 1rem;
  }
  .table-card {
    padding: 0.75rem;
  }
  .modal-content {
    padding: 1.5rem;
    max-width: 95%;
  }
}

@media screen and (max-width: 480px) {
  .topbar .brand {
    font-size: 1.2rem;
  }
  .kpi-value {
    font-size: 1.5rem;
  }
  .kpi.card {
    padding: 1rem 0.75rem;
  }
  .kpi-title {
    font-size: 0.8rem;
  }
  .event-card {
    padding: 1rem 0.8rem;
  }
  .event-title {
    font-size: 0.9rem;
  }
  .event-count {
    font-size: 1.8rem;
  }
  .chart-card h3 {
    font-size: 1rem;
  }
  .table-card h4 {
    font-size: 0.95rem;
  }
  table th, table td {
    font-size: 0.8rem;
    padding: 0.45rem 0.3rem;
  }
  .modal-content {
    padding: 1rem;
    max-width: 98%;
  }
  .modal-content h3 {
    font-size: 1.1rem;
  }
  .modal-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .modal-actions button {
    width: 100%;
    padding: 0.75rem;
  }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
  .kpi.card, .event-card, .chart-card, .table-card {
    min-height: 44px; /* iOS touch target minimum */
  }

  button, .topbar .controls select, .topbar .controls button {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }

  .modal-content input,
  .modal-content textarea,
  .table-card input {
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Add touch feedback */
  .kpi.card:active, .event-card:active {
    transform: scale(0.98);
  }
}

/* Landscape orientation adjustments */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .topbar {
    padding: 0.25rem 1rem;
  }
  .kpi.card {
    padding: 0.75rem 0.5rem;
  }
  .chart-card canvas {
    height: 200px !important;
  }
}
