/* ============================================================
   Sistema de Agendamento de Salas • Padrão IntraSGBBe
   Cores SGB: Azul institucional #154360 + Amarelo #d4ac0d
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&display=swap');

:root {
  --sgb-blue:       #1a5276;
  --sgb-blue-dark:  #154360;
  --sgb-blue-mid:   #2471a3;
  --sgb-blue-light: #d6eaf8;
  --sgb-yellow:     #d4ac0d;
  --sgb-yellow-bg:  #fef9e7;
  --sgb-green:      #1e8449;
  --sgb-red:        #c0392b;
  --text:           #2c3e50;
  --text-muted:     #566573;
  --bg:             #f0f3f4;
  --white:          #ffffff;
  --border:         #d5d8dc;
  --border-light:   #eaecee;
  --radius:         4px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.10);
  --shadow:         0 2px 8px rgba(0,0,0,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Source Sans Pro', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

/* ── SCREENS ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── LOGIN SCREEN ── */
.login-container {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--sgb-blue-dark) 0%, var(--sgb-blue) 100%);
}
.login-box {
  background: var(--white);
  border-radius: 8px;
  border-top: 4px solid var(--sgb-yellow);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.login-box h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--sgb-blue-dark);
  font-size: 1.8rem;
  font-weight: 700;
}
.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.tab-btn {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--border);
  background: var(--white);
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--sgb-blue-dark);
  color: var(--white);
  border-color: var(--sgb-blue-dark);
}
.tab-btn:hover:not(.active) {
  border-color: var(--sgb-blue-mid);
  background: var(--sgb-blue-light);
}

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

/* ── FORMS ── */
.form-group {
  margin-bottom: 1.2rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--sgb-blue-dark);
  font-size: 0.85rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--sgb-blue-mid);
  box-shadow: 0 0 0 3px rgba(36, 113, 163, 0.1);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── BUTTONS ── */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-primary {
  background: var(--sgb-blue-dark);
  color: var(--white);
  border: 2px solid var(--sgb-blue-dark);
}
.btn-primary:hover {
  background: var(--sgb-blue-mid);
  border-color: var(--sgb-blue-mid);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-secondary {
  background: var(--white);
  color: var(--sgb-blue-dark);
  border: 2px solid var(--sgb-blue-dark);
}
.btn-secondary:hover {
  background: var(--sgb-blue-light);
}
.btn-danger {
  background: var(--sgb-red);
  color: var(--white);
  border: 2px solid var(--sgb-red);
}
.btn-danger:hover {
  background: #a93226;
  border-color: #a93226;
}
.btn-success {
  background: var(--sgb-green);
  color: var(--white);
  border: 2px solid var(--sgb-green);
}
.btn-block { width: 100%; }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── MESSAGES ── */
.error-message,
.success-message,
.info-message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  display: none;
  font-size: 0.85rem;
  border-left: 4px solid;
}
.error-message {
  background: #fadbd8;
  color: #641e16;
  border-color: var(--sgb-red);
}
.success-message {
  background: #d5f4e6;
  color: #145a32;
  border-color: var(--sgb-green);
}
.info-message {
  background: var(--sgb-yellow-bg);
  color: #5d4037;
  border-color: var(--sgb-yellow);
}
.error-message.show,
.success-message.show,
.info-message.show {
  display: block;
}

/* ── HEADER ── */
.header {
  background: var(--sgb-blue-dark);
  border-bottom: 4px solid var(--sgb-yellow);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}
.header h1 {
  font-size: 1.4rem;
  color: var(--white);
  font-weight: 700;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.user-name {
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
}

/* ── NAVIGATION ── */
.nav {
  display: flex;
  background: var(--sgb-blue-dark);
  padding: 0 2rem;
  gap: 0.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  max-width: 1400px;
  margin: 0 auto;
}
.nav-btn {
  padding: 1rem 1.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}
.nav-btn:hover {
  color: var(--white);
  background: rgba(255,255,255,0.05);
}
.nav-btn.active {
  color: var(--white);
  border-bottom-color: var(--sgb-yellow);
  background: rgba(255,255,255,0.08);
}

/* ── MAIN CONTENT ── */
.main-content {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}
.view-header h2 {
  font-size: 1.8rem;
  color: var(--sgb-blue-dark);
  font-weight: 700;
}
.filters {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.filters select,
.filters input {
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

/* ── CARDS GRID ── */
.reservas-grid,
.salas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.reserva-card,
.sala-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--sgb-blue-dark);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.reserva-card:hover,
.sala-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.reserva-card h3,
.sala-card h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--sgb-blue-dark);
  font-weight: 700;
}

.reserva-info,
.sala-info-text {
  margin-bottom: 1rem;
}
.reserva-info p,
.sala-info-text p {
  margin: 0.5rem 0;
  color: var(--text);
  font-size: 0.9rem;
}
.reserva-info strong {
  color: var(--sgb-blue-dark);
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-confirmada {
  background: #d5f4e6;
  color: var(--sgb-green);
}
.status-cancelada {
  background: #fadbd8;
  color: var(--sgb-red);
}
.status-concluida {
  background: var(--sgb-blue-light);
  color: var(--sgb-blue);
}

.card-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.card-actions .btn {
  flex: 1;
  padding: 0.6rem;
  font-size: 0.85rem;
}

/* ── FORM RESERVA ── */
.form-reserva {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  border-top: 3px solid var(--sgb-blue-dark);
  box-shadow: var(--shadow-sm);
  max-width: 900px;
}
.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.sala-info {
  background: var(--sgb-yellow-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  border-left: 4px solid var(--sgb-yellow);
  margin: 1.5rem 0;
}
.sala-info h3 {
  margin-bottom: 1rem;
  color: var(--sgb-blue-dark);
  font-size: 1.1rem;
}
.sala-info p {
  margin: 0.5rem 0;
  color: var(--text);
}

/* ── MODAL ── */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
}
.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  border-top: 4px solid var(--sgb-blue-dark);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.3s;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
@keyframes modalSlideIn {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.close {
  position: absolute;
  right: 1.5rem;
  top: 1.5rem;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}
.close:hover {
  color: var(--sgb-red);
}
.modal-content h2 {
  color: var(--sgb-blue-dark);
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
}

/* ── LOADING ── */
.loading-overlay {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  align-items: center;
  justify-content: center;
}
.loading-overlay.active {
  display: flex;
}
.spinner {
  border: 4px solid var(--border-light);
  border-top: 4px solid var(--sgb-blue-dark);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--sgb-blue-dark);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .reservas-grid,
  .salas-grid {
    grid-template-columns: 1fr;
  }
  .header-content {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  .nav {
    flex-wrap: wrap;
    padding: 0 1rem;
  }
  .nav-btn {
    flex: 1;
    min-width: fit-content;
  }
  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .filters {
    flex-direction: column;
    width: 100%;
  }
  .filters select,
  .filters input {
    width: 100%;
  }
  .form-actions,
  .card-actions {
    flex-direction: column;
  }
  .main-content {
    padding: 1rem;
  }
}

/* ── UTILITIES ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
