/*
 * School Management System - Responsive Stylesheet
 * Mobile First Approach with Media Queries
 * Breakpoints: Mobile (≤576px), Tablet (577px-992px), Desktop (≥993px)
 * Author: M Designs
 * Version: 1.0
 */

/* =============================================
   BASE MOBILE STYLES (Default - ≤576px)
   ============================================= */

/* Mobile-first base styles are in main.css */

/* Mobile Navigation */
.menu-toggle {
    display: block;
}

.nav-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--white);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4);
    gap: 0;
}

.nav-menu.active {
    display: flex;
}

.nav-item {
    width: 100%;
}

.nav-link {
    width: 100%;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

/* Mobile Header */
.school-logo {
    max-width: 120px;
}

.school-name {
    font-size: var(--text-2xl);
}

.school-address,
.school-contact {
    font-size: var(--text-sm);
}

/* Mobile Typography */
h1 {
    font-size: var(--text-3xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

h4 {
    font-size: var(--text-lg);
}

/* Mobile Grid */
.row {
    margin: 0;
}

.col,
[class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 var(--space-2);
    margin-bottom: var(--space-4);
}

/* Mobile Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    min-width: 600px;
}

.table th,
.table td {
    padding: var(--space-3);
    font-size: var(--text-sm);
}

/* Mobile Cards */
.card {
    margin-bottom: var(--space-4);
}

.card-header {
    padding: var(--space-4);
    font-size: var(--text-base);
}

.card-body {
    padding: var(--space-4);
}

/* Mobile Forms */
.form-control {
    font-size: 16px;
    /* Prevents zoom on iOS */
    padding: var(--space-4);
}

.btn {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-base);
    min-height: 44px;
    /* Touch-friendly */
    min-width: 44px;
}

.btn-sm {
    min-height: 38px;
    min-width: 38px;
}

/* Mobile Footer */
.footer-links {
    flex-direction: column;
    gap: var(--space-3);
}

/* Mobile Utility */
.mobile-only {
    display: block !important;
}

.tablet-only,
.desktop-only {
    display: none !important;
}

/* Mobile Spacing */
.container {
    padding: 0 var(--space-3);
}

.site-header {
    padding: var(--space-4) 0;
}

/* =============================================
   TABLET STYLES (577px - 992px)
   ============================================= */
@media (min-width: 577px) and (max-width: 992px) {

    /* Tablet Navigation */
    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
    }

    .nav-menu.active {
        display: flex;
    }

    /* Tablet Header */
    .school-logo {
        max-width: 150px;
    }

    .school-name {
        font-size: var(--text-3xl);
    }

    .school-address,
    .school-contact {
        font-size: var(--text-base);
    }

    /* Tablet Typography */
    h1 {
        font-size: var(--text-4xl);
    }

    h2 {
        font-size: var(--text-3xl);
    }

    h3 {
        font-size: var(--text-2xl);
    }

    /* Tablet Grid - 2 Columns */
    .col-md-1 {
        flex: 0 0 8.333333%;
        max-width: 8.333333%;
    }

    .col-md-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-md-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }

    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-md-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-md-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }

    .col-md-10 {
        flex: 0 0 83.333333%;
        max-width: 83.333333%;
    }

    .col-md-11 {
        flex: 0 0 91.666667%;
        max-width: 91.666667%;
    }

    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Tablet Tables */
    .table {
        min-width: auto;
    }

    .table th,
    .table td {
        padding: var(--space-4);
        font-size: var(--text-base);
    }

    /* Tablet Cards */
    .card-header {
        padding: var(--space-5);
        font-size: var(--text-lg);
    }

    .card-body {
        padding: var(--space-5);
    }

    /* Tablet Utility */
    .mobile-only {
        display: none !important;
    }

    .tablet-only {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }

    /* Tablet Spacing */
    .container {
        padding: 0 var(--space-4);
    }

    .site-header {
        padding: var(--space-5) 0;
    }

    /* Tablet Footer */
    .footer-links {
        flex-direction: row;
        gap: var(--space-4);
    }
}

/* =============================================
   DESKTOP STYLES (≥993px)
   ============================================= */
@media (min-width: 993px) {

    /* Desktop Navigation */
    .menu-toggle {
        display: none;
    }

    .nav-menu {
        display: flex;
        flex-direction: row;
        position: static;
        box-shadow: none;
        padding: 0;
        gap: var(--space-2);
    }

    .nav-item {
        width: auto;
    }

    .nav-link {
        width: auto;
        padding: var(--space-3) var(--space-5);
        margin-bottom: 0;
    }

    /* Desktop Header */
    .school-logo {
        max-width: 200px;
    }

    .school-name {
        font-size: var(--text-5xl);
    }

    .school-address,
    .school-contact {
        font-size: var(--text-lg);
    }

    /* Desktop Typography */
    h1 {
        font-size: var(--text-5xl);
    }

    h2 {
        font-size: var(--text-4xl);
    }

    h3 {
        font-size: var(--text-3xl);
    }

    h4 {
        font-size: var(--text-2xl);
    }

    /* Desktop Grid - Full Column System */
    .col-lg-1 {
        flex: 0 0 8.333333%;
        max-width: 8.333333%;
    }

    .col-lg-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-lg-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }

    .col-lg-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-lg-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-lg-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-lg-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }

    .col-lg-10 {
        flex: 0 0 83.333333%;
        max-width: 83.333333%;
    }

    .col-lg-11 {
        flex: 0 0 91.666667%;
        max-width: 91.666667%;
    }

    .col-lg-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Desktop Tables */
    .table th,
    .table td {
        padding: var(--space-4) var(--space-5);
    }

    /* Desktop Cards */
    .card-header {
        padding: var(--space-5) var(--space-6);
    }

    .card-body {
        padding: var(--space-6);
    }

    /* Desktop Utility */
    .mobile-only,
    .tablet-only {
        display: none !important;
    }

    .desktop-only {
        display: block !important;
    }

    /* Desktop Spacing */
    .container {
        max-width: 1200px;
    }

    .site-header {
        padding: var(--space-6) 0;
    }

    /* Desktop Footer */
    .footer-links {
        gap: var(--space-1);
    }

    /* Desktop Hover Effects */
    .card:hover {
        transform: translateY(-8px);
    }

    .btn:hover {
        transform: translateY(-3px);
    }
}

/* =============================================
   LARGE DESKTOP (≥1200px)
   ============================================= */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .school-name {
        font-size: var(--text-5xl);
    }

    h1 {
        font-size: var(--text-5xl);
    }
}

/* =============================================
   EXTRA LARGE DESKTOP (≥1400px)
   ============================================= */
@media (min-width: 1400px) {
    .container {
        max-width: 1600px;
    }
}

/* =============================================
   RESPONSIVE UTILITIES
   ============================================= */

/* Hide on Mobile */
@media (max-width: 576px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on Tablet */
@media (min-width: 577px) and (max-width: 992px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Hide on Desktop */
@media (min-width: 993px) {
    .hide-desktop {
        display: none !important;
    }
}

/* =============================================
   RESPONSIVE TEXT ALIGNMENT
   ============================================= */
@media (max-width: 576px) {
    .text-mobile-center {
        text-align: center;
    }

    .text-mobile-left {
        text-align: left;
    }

    .text-mobile-right {
        text-align: right;
    }
}

@media (min-width: 577px) and (max-width: 992px) {
    .text-tablet-center {
        text-align: center;
    }

    .text-tablet-left {
        text-align: left;
    }

    .text-tablet-right {
        text-align: right;
    }
}

@media (min-width: 993px) {
    .text-desktop-center {
        text-align: center;
    }

    .text-desktop-left {
        text-align: left;
    }

    .text-desktop-right {
        text-align: right;
    }
}

/* =============================================
   RESPONSIVE SPACING
   ============================================= */
@media (max-width: 576px) {
    .mt-mobile-0 {
        margin-top: 0;
    }

    .mt-mobile-4 {
        margin-top: var(--space-4);
    }

    .mb-mobile-0 {
        margin-bottom: 0;
    }

    .mb-mobile-4 {
        margin-bottom: var(--space-4);
    }

    .pt-mobile-0 {
        padding-top: 0;
    }

    .pt-mobile-4 {
        padding-top: var(--space-4);
    }

    .pb-mobile-0 {
        padding-bottom: 0;
    }

    .pb-mobile-4 {
        padding-bottom: var(--space-4);
    }
}

/* =============================================
   RESPONSIVE IMAGES
   ============================================= */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

.img-responsive {
    width: 100%;
    height: auto;
}

/* =============================================
   RESPONSIVE EMBEDS (Videos, iframes)
   ============================================= */
.embed-responsive {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
}

.embed-responsive::before {
    display: block;
    content: "";
}

.embed-responsive-16by9::before {
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
}

.embed-responsive-4by3::before {
    padding-top: 75%;
    /* 4:3 Aspect Ratio */
}

.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object,
.embed-responsive video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* =============================================
   RESPONSIVE DASHBOARD CARDS
   ============================================= */
.dashboard-cards {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: 1fr;
}

@media (min-width: 577px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 993px) {
    .dashboard-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .dashboard-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* =============================================
   RESPONSIVE STAT CARDS
   ============================================= */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-2xl);
}

.stat-number {
    font-size: var(--text-4xl);
    font-weight: 800;
    margin-bottom: var(--space-2);
}

.stat-label {
    font-size: var(--text-base);
    opacity: 0.9;
}

@media (max-width: 576px) {
    .stat-card {
        padding: var(--space-4);
    }

    .stat-number {
        font-size: var(--text-3xl);
    }

    .stat-label {
        font-size: var(--text-sm);
    }
}

/* =============================================
   RESPONSIVE MODAL/DIALOG
   ============================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-4);
}

.modal-content {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 577px) {
    .modal-content {
        max-width: 600px;
    }
}

@media (min-width: 993px) {
    .modal-content {
        max-width: 800px;
    }
}

/* =============================================
   RESPONSIVE BREADCRUMBS
   ============================================= */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: var(--space-3) 0;
    list-style: none;
    gap: var(--space-2);
}

.breadcrumb-item {
    font-size: var(--text-sm);
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "/";
    padding-right: var(--space-2);
    color: var(--gray-400);
}

@media (max-width: 576px) {
    .breadcrumb {
        font-size: var(--text-xs);
    }
}

/* =============================================
   TOUCH-FRIENDLY ENHANCEMENTS
   ============================================= */
@media (hover: none) and (pointer: coarse) {

    /* Touch devices */
    .btn,
    .nav-link,
    .form-check-input {
        min-height: 44px;
        min-width: 44px;
    }

    .table th,
    .table td {
        padding: var(--space-4);
    }
}

/* =============================================
   LANDSCAPE ORIENTATION
   ============================================= */
@media (max-width: 992px) and (orientation: landscape) {
    .site-header {
        padding: var(--space-3) 0;
    }

    .school-logo {
        max-width: 100px;
    }

    .school-name {
        font-size: var(--text-2xl);
    }
}

/* =============================================
   REDUCED MOTION
   ============================================= */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =============================================
   HIGH CONTRAST MODE
   ============================================= */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }

    .card {
        border: 1px solid var(--gray-800);
    }
}

/* =============================================
   DARK MODE SUPPORT (Optional)
   ============================================= */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode support
    :root {
        --gray-50: #111827;
        --gray-100: #1f2937;
        --gray-800: #f3f4f6;
        --gray-900: #ffffff;
    }
    
    body {
        background-color: var(--gray-900);
        color: var(--gray-100);
    }
    */
}