/* Main Application Stylesheet - Logbook Web App */
:root {
  --primary: #8E1559;
  --primary-dark: #640C3E;
  --primary-light: #B31E75;
  --primary-bg: #FDF4F8;
  --accent-gold: #FFB300;
  --accent-yellow: #FFF176;
  --secondary: #1E88E5;
  --success: #2E7D32;
  --success-bg: #E8F5E9;
  --warning: #EF6C00;
  --warning-bg: #FFF3E0;
  --danger: #C62828;
  --danger-bg: #FFEBEE;
  
  --bg-gradient: linear-gradient(135deg, #F8EFF4 0%, #F0F4F8 100%);
  --header-gradient: linear-gradient(135deg, #8E1559 0%, #B31E75 50%, #D81B60 100%);
  --card-shadow: 0 10px 30px rgba(142, 21, 89, 0.08);
  --card-shadow-hover: 0 15px 35px rgba(142, 21, 89, 0.15);

  --text-dark: #2B2D42;
  --text-muted: #6C757D;
  --border-color: #E2E8F0;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --font-heading: 'Prompt', -apple-system, sans-serif;
  --font-body: 'Sarabun', -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header & Navigation */
.app-header {
  background: var(--header-gradient);
  color: #ffffff;
  padding: 1rem 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.school-logo-badge {
  width: 52px;
  height: 52px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  border: 2px solid var(--accent-gold);
  flex-shrink: 0;
}

.school-logo-badge svg {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.brand-titles h1 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.brand-titles p {
  font-size: 0.85rem;
  opacity: 0.9;
  font-weight: 300;
}

/* User Status & Auth Info */
.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  padding: 0.4rem 1rem;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-gold);
  color: var(--primary-dark);
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-role-tag {
  font-size: 0.72rem;
  opacity: 0.85;
}

.btn-header-action {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-header-action:hover {
  background: #ffffff;
  color: var(--primary);
}

/* Navigation Tabs */
.nav-tabs-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.nav-tabs-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  padding: 0 1rem;
  scrollbar-width: none;
}

.nav-tab-btn {
  padding: 0.9rem 1.4rem;
  background: transparent;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}

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

.nav-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.nav-tab-btn .badge-count {
  background: var(--primary-bg);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Main Content Area */
.main-content {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

/* Views & Pages */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* Grid & Cards */
.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 992px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

.card-panel {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(226, 232, 240, 0.8);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Stat Cards */
.stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: var(--card-shadow);
  border-left: 5px solid var(--primary);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-content h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-content .stat-number {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* Status Badges */
.badge-status {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-status.pass {
  background: var(--success-bg);
  color: var(--success);
}

.badge-status.fail {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-status.pending {
  background: var(--warning-bg);
  color: var(--warning);
}

/* Buttons */
.btn {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(142, 21, 89, 0.25);
}

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

.btn-secondary {
  background: #E2E8F0;
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: #CBD5E1;
}

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

.btn-success:hover {
  background: #1B5E20;
}

.btn-warning {
  background: var(--accent-gold);
  color: #000;
}

.btn-warning:hover {
  background: #FF8F00;
  color: #fff;
}

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

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

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.85rem 1.8rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-dark);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  text-align: left;
  font-size: 0.95rem;
}

.custom-table th {
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-family: var(--font-heading);
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid rgba(142, 21, 89, 0.15);
}

.custom-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.custom-table tr:hover {
  background: #FAFBFD;
}

.custom-table tr:last-child td {
  border-bottom: none;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

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

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
}

.modal-header {
  padding: 1.2rem 1.5rem;
  background: var(--header-gradient);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
}

.btn-close-modal:hover {
  opacity: 1;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #F8FAFC;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* Authentication Page Styles */
.auth-page-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #640C3E 0%, #8E1559 40%, #4A0033 100%);
  padding: 2rem 1rem;
}

.auth-container {
  width: 100%;
  max-width: 940px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

@media (max-width: 768px) {
  .auth-container {
    grid-template-columns: 1fr;
  }
}

.auth-banner-side {
  background: linear-gradient(180deg, rgba(142,21,89,0.92) 0%, rgba(100,12,62,0.95) 100%), url('../assets/cover_illustration.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.school-header-brand {
  text-align: center;
}

.school-emblem {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--accent-gold);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.school-emblem svg {
  width: 48px;
  height: 48px;
  color: var(--primary);
}

.school-header-brand h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
}

.school-header-brand p {
  font-size: 0.9rem;
  opacity: 0.9;
}

.auth-form-side {
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-tabs {
  display: flex;
  background: #F1F5F9;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.auth-tab-btn {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: transparent;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.quick-demo-box {
  background: var(--primary-bg);
  border: 1.5px dashed var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1.25rem;
}

.quick-demo-box h4 {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.demo-buttons-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

/* Dropzone & Photo Upload */
.photo-upload-zone {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  background: #F8FAFC;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.photo-upload-zone:hover, .photo-upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.photo-preview-box {
  width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 0.75rem;
}

.photo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Digital Book Preview Cards */
.book-cover-container {
  background: linear-gradient(180deg, #8E1559 0%, #A21766 40%, #750E49 100%);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  color: #ffffff;
  box-shadow: 0 15px 40px rgba(100, 12, 62, 0.4);
  border: 3px solid #FBC02D;
  position: relative;
}

.book-cover-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.book-cover-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  margin-bottom: 0.5rem;
}

.book-cover-subtitle {
  font-size: 1.1rem;
  color: var(--accent-yellow);
}

.book-student-box {
  background: #ffffff;
  color: var(--text-dark);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

/* Footer */
.app-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 1.25rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: auto;
}
