/* ============================================================
   SKYLON SCHOOLS — Dashboard & Forms Stylesheet
   ============================================================ */

:root {
  --primary: #6a0dad;      /* Deep Purple variable from skylon.css */
  --primary-mid: #b570e6;
  --primary-light: #d9baf0;
  --red: #f1250e;
  --gold: #e8a020;
  --cream: #fdfaf4;        /* Slightly optimized warmer white for serif reading comfort */
  --dark: #060652;
  --text: #2c3e50;
  --muted: #5d6d7e;
  --border: #a8d7d3;
  --white: #ffffff;
  --radius: 10px;
  --success: #03862b;
  --orange: #9b4d26; 
  --navy: #720841;
  --green: var(--white); /* Green is now white for the logo, with a custom mark */
  --green-mid: #b8980c;
  --navy-skylon: #060652;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
  /* Swapped out 'DM Sans' for 'Lora' globally across body elements */
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  background-color: var(--cream);
  color: var(--text);
  padding: 40px 5%;
  -webkit-font-smoothing: antialiased;
}

/* --- Container Framework --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: 0 4px 20px rgba(106, 13, 173, 0.04);
  margin-bottom: 30px;
}

/* --- Form Layouts --- */
.form-title {
  font-family: 'Playfair Display', 'Didot', 'Bodoni MT', serif;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 25px;
  font-size: 1.8rem;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-style: italic; /* Distinct academic style definition */
  font-size: 0.95rem;
  color: var(--dark);
}

input, select, textarea {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Lora', Georgia, serif; /* Forces inputs to respect serif format */
  font-size: 0.95rem;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.05);
}

/* --- Action Buttons --- */
.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 25px;
}

.btn {
  padding: 12px 24px;
  border-radius: 5px;
  font-family: 'Lora', Georgia, serif; /* Keeps button fonts styled elegantly */
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-mid); }
.btn-secondary { background: var(--navy); color: var(--white); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--primary-light); color: var(--dark); }
.btn-accent { background: var(--gold); color: var(--white); }
.btn-accent:hover { background: #d49018; }
.btn-danger { background: var(--red); color: var(--white); }
.btn-tertiary { background: var(--orange); color: var(--white); }
.btn-tertiary:hover { background: #e65400; }
.btn-quart { background: var(--red); color: var(--white); }
.btn-quart:hover { background: #e65400; }
.btn-quint { background: var(--muted); color: var(--white); }
.btn-quint:hover { background: #d49018; }
.btn-hex { background: var(--green-mid); color: var(--white); }
.btn-hex:hover { background: var(--primary-mid); }

/* --- Admission Sheet Presentation (PDF/Profile View) --- */
.admission-header {
  text-align: center;
  margin-bottom: 40px;
  border-bottom: 3px double var(--primary);
  padding-bottom: 20px;
}
.admission-header h1 {
  font-family: 'Playfair Display', 'Didot', serif;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
}

.profile-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
}

.photo-box {
  width: 180px;
  height: 180px;
  border: 2px dashed var(--muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  overflow: hidden;
}

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

.info-display-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 30px;
}

.info-display-grid_4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 30px;
}

.info-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.info-item .label { 
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.85rem; 
  color: var(--muted); 
}
.info-item .value { 
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem; 
  font-weight: 600; 
  color: var(--dark); 
  margin-top: 2px; 
}

.declaration-box {
  margin-top: 40px;
  padding: 20px;
  background: var(--cream);
  border-radius: 8px;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.7;
}

.signature-row {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
}
.sig-line {
  border-top: 1.5px solid var(--dark);
  width: 250px;
  text-align: center;
  padding-top: 8px;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.9rem;
  font-weight: 600;
}

/* --- Filter Bar & Tables --- */
.filter-bar {
  display: flex;
  gap: 15px;
  align-items: center;
  background: var(--white);
  padding: 15px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.filter-bar label {
  font-size: 1rem;
}
.table-responsive {
    width: 100%;
    overflow-x: auto;       /* Adds horizontal scroll ONLY if it overflows */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling for mobile devices */
    margin-bottom: 20px;
    border-radius: var(--radius); /* Moves the round edge to the container wrapper */
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    min-width: 1000px;      /* Ensures columns don't crush into unreadable squished text */
    border-collapse: collapse;
    background: var(--white);
    font-family: 'Lora', Georgia, serif; 
}

.data-table th, .data-table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;    /* Prevents badges or numbers from wrapping onto ugly newlines */
}

.data-table th {
  background: var(--primary);
  color: var(--white);
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-style: italic; /* Classic typography format for registrar logs */
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.data-table td strong {
  font-family: 'Playfair Display', serif; /* Gives student names an editorial premium flair */
  font-size: 1.05rem;
}

.data-table tr:hover { background: var(--cream); }

.badge {
  padding: 4px 10px;
  border-radius: 50px;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge-active { background: #e8f8f0; color: var(--success); }
.badge-inactive { background: #fbeaea; color: var(--red); }

/* --- Print View Overrides --- */
@media print {
  body { background: white; padding: 0; color: black; }
  .btn-group, .filter-bar, nav, footer { display: none !important; }
  .card { border: none; box-shadow: none; padding: 0; }
  .photo-box { border: 2px solid black; }
}

/* --- Dashboard Summary Grid --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
  background: var(--primary);
}

.stat-card.paid-card::before { background: var(--success); }
.stat-card.balance-card::before { background: var(--red); }
.stat-card.collection-card::before { background: var(--gold); }

.stat-card .stat-label {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  letter-spacing: 0.3px;
}

.stat-card .stat-value {
  /* Swapped to Playfair Display for massive, premium structural metric statistics */
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--dark);
  margin-top: 10px;
  letter-spacing: -0.5px;
}

.mini-dashboard{
  display: flex; 
  gap: 20px; 
  font-size: 0.9rem; 
  background: #ccddee; 
  padding: 10px 20px; 
  border-radius: 8px; 
  border: 1px solid #c8dbf4;
}

/* --- Progress Tracking Bar --- */
.progress-container {
  background: var(--cream);
  border-radius: 50px;
  height: 8px;
  width: 100%;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar {
  background: var(--gold);
  height: 100%;
  border-radius: 50px;
  transition: width 0.6s ease;
}
.stat-card.paid-card .progress-bar { background: var(--success); }

nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: var(--navy-skylon);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 5%;
    display: flex; align-items: center; justify-content: space-between;
    height: 68px;
    color: var(--white);
  }
  .nav-logo {
    display: flex; align-items: center; gap: 10px;
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem; font-weight: 700;
    color: var(--green); text-decoration: none;
  }
  .nav-logo span { color: var(--red); }
  .nav-logo-mark {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--green);
    display: flex; align-items: center; justify-content: center;
    color: var(--navy-skylon); font-size: 1rem; font-weight: 700;
  }
  .nav-links { display: flex; gap: 2rem; list-style: none; }
  .nav-links a {
    text-decoration: none; color: var(--text);
    font-size: 0.92rem; font-weight: 500;
    transition: color .2s;
  }
  .nav-links a:hover { color: var(--green); }
  .nav-cta {
    background: var(--green); color: (--primary);
    padding: 9px 20px; border-radius: 50px;
    font-size: 0.88rem; font-weight: 600;
    text-decoration: none; transition: background .2s;
  }
  .nav-cta:hover { background: var(--border); }

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}
.login-card {
  width: 100%;
  max-width: 420px;
  border-top: 4px solid var(--primary); /* Deep purple anchor line */
}

.summary-sub-bar {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    background: #ccddee;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #c8dbf4;
}


/* ============================================================
   📱 SKYLON SCHOOLS — Mobile-First Optimization Overrides 
   ============================================================ */

/* ============================================================
   📱 Navigation Bar Mobile Micro-Adjustments
   ============================================================ */

@media (max-width: 768px) {
    /* 1. Prevent global structural overflow */
    body {
        padding: 90px 16px 30px 16px; /* Adds clear spacing below the fixed top nav */
    }

    .container {
        width: 100%;
        overflow-x: hidden;
    }

    .card {
        padding: 16px; /* Frees up screen real estate taken by thick padding */
        margin-bottom: 20px;
    }

    /* 2. Fix the Metric Summary Cards (Prevents truncated text) */
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* Permits a balanced 2-column flow on small viewports */
        gap: 12px;
        margin-bottom: 25px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-label {
        font-size: 0.8rem;
        line-height: 1.2;
    }

    .stat-card .stat-value {
        font-size: 1.6rem; /* Adjusts metrics text sizing to fit alongside currency labels */
        margin-top: 6px;
    }

    /* 3. Fix Grey Informational Sub-Bars & Metadata Details */
    .info-display-grid, 
    .info-display-grid_4 {
        grid-template-columns: repeat(2, 1fr) !important; /* Forces dense labels into a legible 2-column layout */
        gap: 12px 16px;
    }

    /* 4. Navigation Buttons Spacing */
    .btn-group {
        display: grid;
        grid-template-columns: 1fr; /* Stacks button controls into touch-friendly targets */
        gap: 8px;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center; /* Centers alignment for stacked button arrays */
        padding: 10px 16px;
    }

    /* 5. Fix Profile/Form Row Splitting */
    .profile-layout {
        grid-template-columns: 1fr; /* Places the profile picture stack directly above metadata tables */
        gap: 20px;
        justify-items: center;
    }

    /* 1. Hide the school branding logo and mark on the left */
    .nav-logo, 
    .nav-logo-mark {
        display: none !important;
    }

    /* 2. Hide the main page links if they are still present */
    .nav-links {
        display: none !important;
    }

    /* 3. Force the nav bar to space out the user greeting and logout button */
    nav {
        justify-content: space-between; /* Pushes greeting to left, logout to right */
        padding: 0 16px; /* Tighter padding for mobile edges */
    }

    /* 4. Ensure your welcome text is visible and styled cleanly on the left */
    nav .welcome-text {
        display: block !important;
        font-family: 'Lora', Georgia, serif;
        font-size: 0.9rem;
        color: var(--white);
    }
}

@media (max-width: 480px) {
    /* Tight mobile optimization for small phone screen views */
    .dashboard-grid {
        grid-template-columns: 1fr !important; /* Drops metrics into a clean single-column presentation list */
    }

    .info-display-grid, 
    .info-display-grid_4 {
        grid-template-columns: 1fr !important; /* Safely lists parameters cleanly down the viewport screen space */
    }
}

/* 📱 Automatic Mobile Adaptation Layout */
@media (max-width: 768px) {
    .summary-sub-bar {
        flex-direction: column; /* Stacks items neatly onto individual rows on phone screens */
        gap: 8px;
        padding: 12px;
    }
}