/* ==========================================================================
   Warm Orange, Rich Brown & Cream Visual Theme
   ========================================================================== */

:root {
  --primary-color: #7c2d12;      /* Rich Deep Warm Brown */
  --primary-hover: #451a03;      /* Dark Espresso Brown */
  --secondary-color: #ea580c;    /* Vibrant Burnt Orange */
  --secondary-hover: #c2410c;    /* Darker Terracotta Orange */
  --accent-gold: #f97316;        /* Warm Vibrant Orange Accent */
  --whatsapp-color: #25d366;     /* WhatsApp Green */
  --whatsapp-hover: #128c7e;
  --bg-color: #fcf8f2;           /* Warm Cream / Sand Background */
  --card-bg: #ffffff;            /* Pure White Card Fill */
  --text-dark: #291d18;          /* Espresso Dark Text */
  --text-muted: #785e54;         /* Muted Warm Brown Text */
  --border-color: #ebdcd5;       /* Soft Cream / Sand Border */
  --success-color: #15803d;      /* Forest Green */
  --warning-color: #d97706;      /* Amber Warning */
  --danger-color: #b91c1c;       /* Maroon Red */
  --radius: 6px;
  --shadow: 0 4px 14px rgba(124, 45, 18, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Arial, Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-color);
  color: var(--text-dark);
  line-height: 1.6;
}

/* Header & Banner */
header {
  background: linear-gradient(135deg, #451a03 0%, #7c2d12 60%, #9a3412 100%);
  color: #ffffff;
  padding: 1.8rem 1rem;
  text-align: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
  border-bottom: 4px solid var(--accent-gold); /* Warm Orange Stripe */
  position: relative;
}

header h1 {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: 0.5px;
  word-wrap: break-word;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

header p {
  font-size: 0.95rem;
  color: #ffedd5;
  font-weight: 500;
}

/* Navigation Bar */
nav.nav-bar {
  background-color: #2e1002; /* Deep Dark Brown Nav */
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

nav.nav-bar a {
  color: #fed7aa;
  text-decoration: none;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all 0.25s ease-in-out;
  white-space: nowrap;
}

nav.nav-bar a:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

nav.nav-bar a.active {
  background-color: var(--secondary-color);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.4);
}

/* Main Container */
.container {
  max-width: 1100px;
  width: 100%;
  margin: 1.6rem auto;
  padding: 0 1rem;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.6rem;
  border-top: 4px solid var(--primary-color);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  max-width: 100%;
  word-wrap: break-word;
}

.card h2 {
  color: var(--primary-color);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  border-bottom: 2px solid #f3e7e1;
  padding-bottom: 0.5rem;
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.1rem;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-dark);
}

input, select, textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 16px;
  background-color: #ffffff;
  color: var(--text-dark);
  transition: border-color 0.25s, box-shadow 0.25s;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.18);
  background-color: #fffdfa;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.25s, box-shadow 0.25s;
  text-decoration: none;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(124, 45, 18, 0.2);
}

.btn:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(124, 45, 18, 0.3);
}

.btn-whatsapp {
  background-color: var(--whatsapp-color);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
  background-color: var(--whatsapp-hover);
}

.btn-danger {
  background-color: var(--danger-color);
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.3);
}

.btn-danger:hover {
  background-color: #991b1b;
}

.btn-success {
  background-color: var(--success-color);
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.3);
}

.btn-success:hover {
  background-color: #166534;
}

/* Service & Room Cards */
.rooms-grid, .halls-grid, .module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.3rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.room-card, .hall-card, .module-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: 0 2px 8px rgba(124, 45, 18, 0.06);
  border-top: 4px solid var(--primary-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  transition: transform 0.2s, box-shadow 0.2s;
}

.room-card:hover, .hall-card:hover, .module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(124, 45, 18, 0.12);
}

.room-card h3, .hall-card h3, .module-card h3 {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-pending {
  background-color: #ffedd5;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.badge-approved {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #22c55e;
}

.badge-rejected {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #f87171;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
  margin-top: 1rem;
}

table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  border: 1px solid var(--border-color);
}

th, td {
  padding: 0.8rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

th {
  background-color: var(--primary-color);
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.3px;
}

tr:nth-child(even) {
  background-color: #fdfaf6;
}

tr:hover {
  background-color: #f9f2ec;
}

/* Confirmation Box */
.confirmation-box {
  background-color: #f0fdf4;
  border: 2px solid var(--success-color);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-align: center;
  margin-top: 1.4rem;
  word-wrap: break-word;
}

.confirmation-box h3 {
  color: var(--success-color);
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

/* ==========================================================================
   Calendar Table & Grid Styling (Guaranteed 100% Column Alignment)
   ========================================================================== */
.cal-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.cal-table {
  width: 100%;
  min-width: 750px; /* Minimum table width for mobile scrolling */
  border-collapse: collapse;
  table-layout: fixed; /* Strictly forces all 7 columns to be equal 1/7th width! */
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-sizing: border-box;
}

.cal-table th {
  width: 14.285%; /* Exactly 1/7th of 100% */
  background-color: var(--primary-color);
  color: #ffffff;
  font-weight: 700;
  padding: 0.65rem 0.2rem;
  font-size: 0.85rem;
  text-align: center;
  border: 1px solid var(--primary-color);
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-table td.cal-day-cell {
  width: 14.285%; /* Exactly 1/7th of 100% matching th headers */
  height: 95px;
  vertical-align: top;
  border: 1px solid #ebdcd5;
  padding: 0.35rem;
  box-sizing: border-box;
  overflow: hidden;
  background: #ffffff;
  cursor: pointer;
  transition: background 0.2s;
}

.cal-table td.cal-day-cell:hover {
  background: #fff7ed;
}

.cal-table td.cal-day-cell.today {
  background: #ffedd5;
  outline: 2px solid var(--secondary-color);
  outline-offset: -2px;
}

.cal-table td.cal-day-cell.empty {
  background: #f7f0ea;
  cursor: default;
}

.cal-day-number {
  font-weight: 700;
  font-size: 0.85rem;
  color: #362118;
  margin-bottom: 4px;
}

.cal-events-wrapper {
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-sizing: border-box;
}

.cal-event-badge {
  font-size: 0.72rem;
  padding: 2px 5px;
  border-radius: 3px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.cal-event-badge.circuit {
  background: #ffedd5;
  color: #c2410c;
  border-left: 3px solid var(--secondary-color);
}

.cal-event-badge.hall {
  background: #fef3c7;
  color: #92400e;
  border-left: 3px solid var(--warning-color);
}

.cal-more-tag {
  font-size: 0.7rem;
  color: #785e54;
  font-weight: bold;
  margin-top: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(46, 16, 2, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.6rem;
  box-shadow: 0 10px 30px rgba(46, 16, 2, 0.3);
  border-top: 5px solid var(--primary-color);
}

/* Footer */
footer {
  background-color: #2e1002;
  color: #fed7aa;
  text-align: center;
  padding: 1.4rem 1rem;
  font-size: 0.88rem;
  border-top: 3px solid var(--secondary-color);
  margin-top: 2.5rem;
}

footer p {
  color: #fdba74;
}

/* MOBILE RESPONSIVE MEDIA QUERIES */
@media (max-width: 640px) {
  header {
    padding: 1.3rem 0.75rem;
  }

  header h1 {
    font-size: 1.35rem;
  }

  header p {
    font-size: 0.85rem;
  }

  .container {
    padding: 0 0.5rem;
    margin: 1rem auto;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
  }

  .form-grid, .rooms-grid, .halls-grid, .module-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .btn {
    width: 100%;
    padding: 0.75rem 1rem;
  }

  .cal-table td.cal-day-cell {
    height: 70px;
    padding: 2px;
  }

  .cal-event-badge {
    font-size: 0.65rem;
    padding: 1px 2px;
  }
}
