/* css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 270px;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Sidebar – base layout only; visual styles live in sidebar.php */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    height: 100vh;
    z-index: 100;
}



/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.875rem;
    font-weight: 700;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 1.25rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
}

td {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-present { background: #d1fae5; color: #065f46; }
.badge-absent { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.875rem;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

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

/* Modal Enhancements */
.modal-content {
    background: white;
    width: 500px;
    margin: 50px auto;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
/* Print Header Styles */
.print-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}
.print-header img {
    max-height: 60px;
    margin-right: 1rem;
}
.print-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin: 0;
}
/* Hide print header on screen */
@media screen {
    .print-header { display:none; }
}

/* Print Styles */
@media print {
    .sidebar, .btn, header .btn { display: none !important; }
    .main-content { margin-left: 0; padding: 0; }
    .card { box-shadow: none; border: none; }
}

/* Enable scrolling on modal container overlays if they exceed screen height */
#staffModal, #studentModal, #userModal, #slotModal, #leaveModal, #feeModal, #actionModal, #homeworkModal, #addTermModal, #editTermModal, #addModal, #bulkModal, #bulkFeeModal, #feeHistoryModal {
    overflow-y: auto !important;
}

/* ── Mobile & Touch Device Optimization ── */
@media screen and (max-width: 1024px) {
    /* Sidebar slides in from left */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9995 !important;
        pointer-events: auto !important;
    }
    .sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.8) !important;
    }
    .sidebar * {
        pointer-events: auto !important;
    }
    
    /* Main content full-width with top/bottom padding for bars */
    .main-content {
        margin-left: 0 !important;
        padding: 1rem !important;
        padding-top: calc(58px + 1rem) !important;
        padding-bottom: calc(64px + 1rem) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Header layout adjustments */
    header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
        margin-bottom: 1.25rem !important;
        padding-bottom: 0.75rem !important;
        border-bottom: 1px solid var(--border);
    }
    header > div:first-child {
        gap: 0.85rem !important;
    }
    header img {
        width: 42px !important;
        height: 42px !important;
    }
    header h1 {
        font-size: 1.35rem !important;
        margin: 0 !important;
    }
    header p {
        font-size: 0.8rem !important;
    }
    
    /* User profile header badges on mobile */
    header .user-profile {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        margin-top: 0.25rem !important;
    }
    /* Hide redundant inline Logout button inside header profile because top bar has it */
    header .user-profile a.btn,
    header .user-profile a[href="logout.php"],
    header .user-profile .btn-logout {
        display: none !important;
    }
    header .user-profile span {
        font-size: 0.78rem !important;
        padding: 0.35rem 0.75rem !important;
    }

    /* Welcome banner responsiveness */
    .welcome-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 1.35rem 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    .welcome-banner > div:first-child {
        max-width: 100% !important;
    }
    .welcome-banner h2 {
        font-size: 1.35rem !important;
    }
    .welcome-banner p {
        font-size: 0.9rem !important;
    }

    /* Action grid single column on mobile */
    .action-grid {
        grid-template-columns: 1fr !important;
        gap: 0.85rem !important;
    }
    /* Stats grid 2 columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* Action / Notification alert boxes stack vertically on mobile */
    div[style*="background: #fffbe6"],
    div[style*="background: #e6fffa"],
    div[style*="background: #feefc3"],
    div[style*="background: #ecfdf5"],
    .card-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    div[style*="background: #fffbe6"] a,
    div[style*="background: #e6fffa"] a,
    div[style*="background: #feefc3"] a,
    div[style*="background: #ecfdf5"] a,
    .card-header .btn {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
}

@media screen and (max-width: 640px) {
    h1 {
        font-size: 1.2rem !important;
    }
    .stat-card {
        padding: 1rem !important;
    }
    .stat-card p {
        font-size: 1.2rem !important;
    }
    .card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        border-radius: 0.85rem !important;
    }
    .card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
    .form-control, select, input[type="text"], input[type="number"], input[type="date"] {
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
    }
    table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
    }
    .action-card {
        padding: 1rem !important;
    }
    .action-icon {
        width: 44px !important;
        height: 44px !important;
    }
}


