@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Amiri:wght@400;700&display=swap');

:root {
  --bg-dark:          #2d3e5a;   /* primary dark navy — hero, cover, section headers */
  --bg-dark-mid:      #3a4f6e;   /* mid navy — cards on dark pages, info boxes */
  --bg-dark-deep:     #1e2d42;   /* deepest navy — footer, overlays */
  --bg-light:         #f5e6d0;   /* warm peach — content page background */
  --bg-light-deep:    #ede0cc;   /* deeper peach — gradient bottom */
  --accent:           #c2714f;   /* copper orange — diamonds, labels, CTAs, dates */
  --accent-hover:     #d4835f;   /* lighter orange — hover states */
  --accent-sand:      #e8c5a0;   /* sand — secondary text on dark pages */
  --text-on-dark:     #f0f4ff;   /* near white — headings on dark */
  --text-on-light:    #2d3e5a;   /* navy — body text on peach pages */
  --text-muted-dark:  #a0b4cc;   /* muted on dark */
  --text-muted-light: #6b7f96;   /* muted on peach */
  --border-dark:      rgba(255,255,255,0.1);
  --border-light:     rgba(45,62,90,0.15);
  --radius-card:      12px;
  --radius-btn:       6px;
}

body {
  font-family: 'Tajawal', 'Segoe UI', system-ui, sans-serif;
  direction: rtl;
  text-align: right;
  background: linear-gradient(180deg, #f5e6d0 0%, #ede0cc 100%);
  color: #2d3e5a;
  min-height: 100vh;
}

.dark-mode-page {
  background: #2d3e5a;
  color: #f0f4ff;
}

/* Typographic Scale */
h1, .page-title, .cover-title {
  font-family: 'Tajawal', sans-serif;
  font-weight: 800;
  font-size: 28px;
}
@media (min-width: 768px) {
  h1, .page-title, .cover-title { font-size: 36px; }
}

h2, .section-heading {
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 18px;
}
@media (min-width: 768px) {
  h2, .section-heading { font-size: 22px; }
}

h3, .card-title {
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 16px;
}
@media (min-width: 768px) {
  h3, .card-title { font-size: 18px; }
}

p, .body-text {
  font-family: 'Tajawal', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.8;
}
@media (min-width: 768px) {
  p, .body-text { font-size: 16px; }
}

.label, .tag, .badge {
  font-family: 'Tajawal', sans-serif;
  font-weight: 500;
  font-size: 12px;
}
@media (min-width: 768px) {
  .label, .tag, .badge { font-size: 13px; }
}

.date, .number, .date-number {
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  color: #c2714f;
}

.brand-calligraphic {
  font-family: 'Amiri', serif;
  font-weight: 700;
}
.brand-tajawal {
  font-family: 'Tajawal', sans-serif;
  font-weight: 800;
}

/* Diamond Motif */
.dm {
  display: inline-block;
  width: 10px; height: 10px;
  background: #c2714f;
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-left: 8px;
}

.dm-dark { background: #2d3e5a; }

.dm-lg {
  width: 20px; height: 20px;
  background: #c2714f;
  transform: rotate(45deg);
}

.photo-diamond {
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #c2714f;
  color: #ffffff;
  font-family: 'Tajawal', sans-serif;
  font-size: 18px;
  font-weight: 700;
  padding: 6px 20px 6px 28px;
  border-radius: 5px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
  margin-bottom: 12px;
}
.section-label::before {
  content: '';
  width: 10px; height: 10px;
  background: #fff;
  transform: rotate(45deg);
  flex-shrink: 0;
}

.info-box {
  background: #3a4f6e;
  border-radius: 12px;
  padding: 16px 18px;
  color: #f0f4ff;
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.8;
  text-align: center;
  margin: 12px 0;
}

.orange-box {
  background: #c2714f;
  border-radius: 14px;
  padding: 18px 20px;
  color: #ffffff;
  font-family: 'Tajawal', sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 2;
  text-align: center;
  position: relative;
  margin-top: 16px;
}
.orange-box::before {
  content: '';
  position: absolute;
  top: -12px;
  right: 50%;
  transform: translateX(50%);
  border: 8px solid transparent;
  border-bottom-color: #c2714f;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
  margin: 14px 0;
}
.feature-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.feature-title {
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #2d3e5a;
  text-align: right;
  line-height: 1.5;
  display: flex;
  align-items: center;
}
.feature-line {
  width: 60%;
  height: 2px;
  background: #c2714f;
  border-radius: 1px;
  align-self: flex-end;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: 12px 0;
}
.photo-cell {
  aspect-ratio: 1;
  overflow: hidden;
  position: relative;
  clip-path: polygon(50% 3%, 97% 50%, 50% 97%, 3% 50%);
}
.photo-cell img {
  width: 100%; height: 100%; object-fit: cover;
}
.photo-num {
  position: absolute;
  top: 20%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #c2714f;
  color: #fff;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.grid-center-label {
  background: #c2714f;
  color: #fff;
  font-family: 'Tajawal', sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  clip-path: polygon(50% 3%, 97% 50%, 50% 97%, 3% 50%);
}

.session-row {
  display: flex;
  align-items: stretch;
  border-radius: 6px;
  overflow: hidden;
  margin: 14px 0 10px;
}
.session-number {
  background: #c2714f;
  color: #fff;
  font-size: 48px;
  font-weight: 800;
  padding: 8px 18px;
  font-family: 'Tajawal', sans-serif;
}
.session-text {
  background: #3a4f6e;
  color: #f0f4ff;
  font-size: 24px;
  font-weight: 700;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  font-family: 'Tajawal', sans-serif;
}
.cover-date-year {
  color: #c2714f;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.footer {
  background: #1e2d42;
  border-radius: 12px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 12px;
  align-items: start;
}
.footer-divider {
  background: rgba(255,255,255,0.12);
  height: 100%;
}
.footer-heading {
  font-family: 'Tajawal', sans-serif;
  font-size: 16px; font-weight: 700;
  color: #f0f4ff;
  text-decoration: underline;
  text-underline-offset: 4px;
  margin-bottom: 6px;
}
.footer-value {
  font-size: 14px; color: #e8c5a0; line-height: 1.6;
}
.footer-phone {
  font-size: 20px; font-weight: 800;
  color: #c2714f;
  direction: ltr;
  display: block; margin-top: 6px;
}
.footer-cta {
  display: inline-flex; align-items: center; gap: 4px;
  background: #c2714f; color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 6px;
  margin-top: 6px; cursor: pointer;
}

.body-text-block {
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #2d3e5a;
  line-height: 1.85;
  text-align: right;
}
.orange-subtitle {
  font-size: 18px; font-weight: 800; color: #c2714f; text-align: center;
}

.label-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.label-list-item .label-text {
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #2d3e5a;
}

::-webkit-scrollbar { width: 4px; background: #1e2d42; }
::-webkit-scrollbar-thumb { background: #c2714f; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #d4835f; }

/* Existing component overwrites to adhere to accent color rule */
.btn-primary, .btn-success, .btn-info, .btn-warning, .btn-danger, .btn-outline-primary, .btn-outline-success {
  background-color: #c2714f !important;
  border-color: #c2714f !important;
  color: #fff !important;
}
.btn-primary:hover, .btn-success:hover, .btn-info:hover, .btn-warning:hover, .btn-danger:hover {
  background-color: #d4835f !important;
  border-color: #d4835f !important;
}
header {
  background: #2d3e5a;
  border-bottom: 2px solid #c2714f;
}
.navbar-brand, .navbar-brand span {
  font-family: 'Amiri', serif;
  color: #c2714f !important;
  font-weight: 700;
}
.nav-link {
  font-family: 'Tajawal', sans-serif;
  color: #f0f4ff !important;
}
.nav-link:hover {
  color: #c2714f !important;
}

/* --- UI COMPONENTS RESTORATION & MODERNIZATION --- */

/* Navbar Logo Adjustments */
.navbar-logo {
  height: 45px;
  max-height: 45px;
  width: auto;
  object-fit: contain;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.navbar-logo:hover {
  transform: scale(1.02);
}

/* Base Cards */
.card {
  background-color: var(--bg-light);
  color: var(--bg-dark);
  border-radius: var(--radius-card);
  border: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.dark-mode-page .card {
  background-color: var(--bg-dark-mid) !important;
  color: var(--text-on-dark) !important;
}

/* Modern Dashboard Action Cards */
.action-card {
  background-color: #ffffff;
  color: var(--bg-dark);
  border-radius: var(--radius-card);
  border: 1px solid rgba(194, 113, 79, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.dark-mode-page .action-card {
  background-color: var(--bg-dark-mid);
  color: var(--text-on-dark);
  border-color: rgba(255,255,255,0.05);
}
.action-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(194, 113, 79, 0.12);
  border-color: var(--accent);
}
.action-card .card-title {
  color: var(--bg-dark);
}
.dark-mode-page .action-card .card-title {
  color: var(--text-on-dark);
}

.action-icon-wrapper {
  background: rgba(194, 113, 79, 0.12);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); /* diamond shape */
  margin-bottom: 12px;
  transition: all 0.3s ease;
}
.action-card:hover .action-icon-wrapper {
  background: var(--accent);
}
.action-icon {
  color: var(--accent);
  font-size: 20px;
  transition: all 0.3s ease;
}
.action-card:hover .action-icon {
  color: #fff;
}

/* Modern Buttons */
.btn-modern {
  background-color: var(--accent);
  color: #ffffff !important;
  border-radius: var(--radius-btn);
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  border: none;
  padding: 8px 24px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(194, 113, 79, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-modern:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(194, 113, 79, 0.3);
}

/* Global Buttons Overwrite */
.btn {
  border-radius: var(--radius-btn);
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn:active {
  transform: scale(0.97);
}

.text-accent {
  color: var(--accent) !important;
}

.custom-table-card {
  background-color: #ffffff !important;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.dark-mode-page .custom-table-card {
  background-color: var(--bg-dark-mid) !important;
}

/* --- MOBILE SPECIFIC ENHANCEMENTS --- */
@media (max-width: 767.98px) {
  .navbar-logo {
    height: 36px;
    max-height: 36px;
  }
  .action-card {
    padding: 16px 12px !important;
  }
  .action-icon-wrapper {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
  }
  .action-icon {
    font-size: 16px;
  }
  .action-card .card-title {
    font-size: 14px !important;
    margin-bottom: 12px !important;
  }
  .btn-modern {
    padding: 6px 12px;
    font-size: 13px;
  }
  .info-box {
    padding: 12px !important;
  }
  .info-box i.fa-2x {
    font-size: 1.5em; 
  }
  .info-box .display-6 {
    font-size: 24px;
  }
}

/* Force transparent background for nav-links to override any lingering Bootstrap defaults or cached styles */
.navbar-nav .nav-link {
    background-color: transparent !important;
}
.navbar-nav .nav-link:hover, .navbar-nav .nav-link:focus {
    background-color: transparent !important;
}

/* Student Profile Specific Styles */
.hero-profile {
    background-color: var(--bg-dark) !important;
    background-image: none !important;
    border-bottom: 4px solid var(--accent) !important;
}
.hero-profile .page-title,
.hero-profile .label-text {
    color: var(--text-on-dark) !important;
}
.hero-profile .dm {
    background-color: var(--accent) !important;
}
.btn-toolbar-custom .btn-modern {
    flex: 1 1 auto;
    text-align: center;
    min-width: 140px;
    color: #ffffff !important;
    border: none !important;
}
.btn-add-progress { background-color: var(--accent) !important; }
.btn-full-record { background-color: var(--bg-dark-mid) !important; }
.btn-edit-grades { background-color: var(--bg-dark-mid) !important; }
.btn-pdf-report { background-color: var(--bg-dark) !important; }
.btn-excel-report { background-color: #2e7d32 !important; }
.btn-certificate { background-color: #b78a00 !important; }

.stat-box {
    background: rgba(194, 113, 79, 0.04);
    border: 1px solid rgba(194, 113, 79, 0.1);
    transition: all 0.3s ease;
}
.stat-box:hover {
    background: rgba(194, 113, 79, 0.08);
    transform: translateY(-2px);
}
.report-stat-box {
    background: #f8f9fa;
    border: 1px solid rgba(0,0,0,0.03);
}
.profile-card-heading {
    color: var(--bg-dark) !important;
}
.profile-date-tag {
    background: rgba(194, 113, 79, 0.12) !important;
    color: var(--accent) !important;
    border: 1px solid rgba(194, 113, 79, 0.18) !important;
}
.profile-followup-form-card label,
.profile-followup-form-card .form-label,
.profile-followup-form-card .form-text,
.profile-followup-form-card .text-muted,
.profile-followup-form-card .form-select,
.profile-followup-form-card .form-control {
    color: var(--bg-dark) !important;
}
.profile-followup-form-card .form-select,
.profile-followup-form-card .form-control {
    background: #ffffff !important;
    border: 1px solid rgba(45, 62, 90, 0.18) !important;
}
.profile-followup-form-card .form-select:focus,
.profile-followup-form-card .form-control:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 0.15rem rgba(194, 113, 79, 0.12) !important;
}
.profile-followup-status-card {
    background: var(--bg-dark) !important;
    color: var(--text-on-dark) !important;
}
.profile-followup-status-title {
    color: var(--text-on-dark) !important;
}
.profile-followup-status-note,
.profile-followup-status-time {
    color: var(--accent-sand) !important;
}
.profile-note-card {
    color: var(--text-on-light) !important;
}
.profile-note-author,
.profile-note-body {
    color: var(--bg-dark) !important;
}
.profile-note-form-card {
    background: var(--bg-dark) !important;
    color: var(--text-on-dark) !important;
}
.profile-note-form-title {
    color: var(--text-on-dark) !important;
}
.note-form-container label { 
    color: #f0f4ff !important; 
    font-weight: 600; 
    margin-bottom: 8px;
}
.note-form-container .form-control { 
    background: rgba(255,255,255,0.05); 
    border: 1px solid rgba(255,255,255,0.15); 
    color: #fff; 
}
.note-form-container .form-control:focus { 
    background: rgba(255,255,255,0.1); 
    color: #fff; 
    box-shadow: none; 
    border-color: var(--accent); 
}
.note-form-container .form-control::placeholder {
    color: rgba(240, 244, 255, 0.72) !important;
}
.note-form-container .form-text,
.note-form-container .invalid-feedback,
.note-form-container .form-check-label {
    color: var(--accent-sand) !important;
}

/* Progress Form Specific Styles */
.progress-form-card {
    background-color: var(--bg-light) !important;
}
.rating-system-container {
    background: rgba(255,255,255,0.7) !important;
    border: 1px solid var(--border-light) !important;
}
.score-display-alert {
    background-color: var(--bg-dark) !important;
    color: var(--text-on-dark) !important;
}
.btn-radius {
    border-radius: var(--radius-btn) !important;
}

.app-shell {
    min-height: 70vh;
    max-width: 1400px;
    padding-left: 15px;
    padding-right: 15px;
}

.navbar-login-link {
    text-decoration: none;
}

.bottom-nav {
    display: none;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    background-color: #ffffff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 10px 0;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav-item {
    text-align: center;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.8rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border: 0;
}

.bottom-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.bottom-nav-item.active,
.bottom-nav-item:hover,
.bottom-nav-item:focus {
    color: var(--accent);
}

.bottom-nav-button {
    font-family: 'Tajawal', sans-serif;
}

.login-wrapper {
    min-height: 80vh;
}

.login-panel {
    max-width: 420px;
    padding: 0 15px;
}

.login-card {
    background: var(--bg-dark-mid);
    border-radius: var(--radius-card);
    overflow: hidden;
}

.login-card-footer {
    background: var(--bg-dark-deep);
    border-top: 1px solid var(--border-dark);
}

.lockout-card {
    max-width: 520px;
}

@media (max-width: 991.98px) {
    .bottom-nav {
        display: flex;
    }

    body {
        padding-bottom: 90px !important;
    }

    .main-content {
        padding-bottom: 30px;
    }
}
