/* 
 * School Management System - Phase 16 Global Typography System
 * Primary Font: Poppins (Regular 400, Medium 500, SemiBold 600, Bold 700)
 */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap');

:root {
    /* Centralized Typography Tokens */
    --font-family-primary: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    
    /* Font Size Scale (Desktop / Tablet) */
    --font-size-xs: 0.8125rem;   /* 13px */
    --font-size-sm: 0.875rem;    /* 14px */
    --font-size-base: 1rem;      /* 16px */
    --font-size-lg: 1.125rem;    /* 18px */
    --font-size-xl: 1.25rem;     /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-3xl: 1.875rem;   /* 30px */
    --font-size-4xl: 2.25rem;    /* 36px */

    /* Line Heights */
    --line-height-body: 1.55;
    --line-height-heading: 1.25;
    --line-height-tight: 1.15;
    --line-height-table: 1.45;
}

html {
    font-family: var(--font-family-primary);
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-body);
    font-weight: 400;
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Headings Typography */
h1, .h1 {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-3xl);
    line-height: var(--line-height-heading);
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #0f172a;
}

h2, .h2 {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-2xl);
    line-height: var(--line-height-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
}

h3, .h3 {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-xl);
    line-height: var(--line-height-heading);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: #1e293b;
}

h4, .h4 {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-heading);
    font-weight: 600;
    color: #1e293b;
}

/* Form Controls & Inputs Readability */
input, select, textarea, button, optgroup, label {
    font-family: var(--font-family-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: #0f172a;
    transition: all 0.15s ease-in-out;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: #334155;
    letter-spacing: -0.01em;
}

/* Buttons Readability */
button, .btn, input[type="submit"] {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Table Typography & Readability */
table {
    font-family: var(--font-family-primary);
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #475569;
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
}

tbody td {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-table);
    color: #334155;
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
}

tbody tr:hover {
    background-color: rgba(248, 250, 252, 0.9);
}

/* Navigation & Sidebar Legibility */
nav a, .nav-link {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Cards & Modals */
.card, .modal-box {
    font-family: var(--font-family-primary);
}

/* Badges & Status Tags */
.badge, span.badge {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Accessibility Focus States */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Glassmorphic elements */
.glass-panel {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Transition Utilities */
.sidebar-transition {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Responsive Typography */
@media (max-width: 640px) {
    html {
        font-size: 15px;
    }
    
    h1, .h1 {
        font-size: 1.5rem; /* 24px */
    }
    
    h2, .h2 {
        font-size: 1.25rem; /* 20px */
    }
    
    h3, .h3 {
        font-size: 1.125rem; /* 18px */
    }
    
    tbody td {
        font-size: 0.8125rem; /* ~13px on mobile */
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
    }
    
    button, .btn, input, select, textarea {
        min-height: 40px; /* Touch friendly */
    }
}

/* High-Contrast Print Typography */
@media print {
    .no-print {
        display: none !important;
    }
    body {
        font-family: var(--font-family-primary) !important;
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 12pt !important;
    }
    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    th, td {
        border: 1px solid #cbd5e1 !important;
        padding: 6pt !important;
        font-size: 10pt !important;
    }
}
