/* ============================================
   RESPONSIVE SCHOOL ATTENDANCE SYSTEM
   Mobile-First Design with Desktop Enhancements
   ============================================ */

/* Root Variables */
:root {
    --primary-color: #4e73df;
    --primary-dark: #2e59d9;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-bg: #f8f9fc;
    --text-color: #5a5c69;
    --border-color: #e3e6f0;
    --shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

/* ============================================
   GENERAL STYLES
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--light-bg);
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.6;
    touch-action: pan-x pan-y;
}

/* ============================================
   WRAPPER & LAYOUT
   ============================================ */

.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    flex-direction: column;
}

/* ============================================
   SIDEBAR - MOBILE FIRST
   ============================================ */

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: var(--primary-color);
    color: #fff;
    transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease;
    transform: translateX(-100%);
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

#sidebar.active {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

#sidebar .sidebar-header {
    padding: 20px;
    background: var(--primary-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#sidebar .sidebar-header h3 {
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

#sidebar ul.components {
    padding: 15px 0;
    list-style: none;
}

#sidebar ul li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar ul li a {
    padding: 15px 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
}

#sidebar ul li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    padding-left: 25px;
}

#sidebar ul li.active > a {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    font-weight: bold;
    border-left: 4px solid #fff;
    padding-left: 16px;
}

#sidebar ul li a i {
    min-width: 20px;
    text-align: center;
}

/* ============================================
   CONTENT AREA
   ============================================ */

#content {
    width: 100%;
    min-height: 100vh;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.navbar {
    padding: 12px 15px;
    background: #fff;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.navbar .container-fluid {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

#sidebarCollapse {
    padding: 10px 15px;
    background: var(--info-color);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease, transform 0.2s ease;
    position: relative;
    z-index: 1001;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#sidebarCollapse:active {
    transform: scale(0.95);
}

#sidebarCollapse:hover {
    background: #2b9aad;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#sidebarCollapse:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

#sidebarCollapse span {
    margin-left: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.user-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info img {
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    object-fit: cover;
}

.main-content {
    padding: 15px;
    flex: 1;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.card-header {
    padding: 15px;
    background: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-body {
    padding: 15px;
}

/* ============================================
   STAT CARDS
   ============================================ */

.stat-card {
    border-left: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card.success { border-left-color: var(--success-color); }
.stat-card.info { border-left-color: var(--info-color); }
.stat-card.warning { border-left-color: var(--warning-color); }
.stat-card.danger { border-left-color: var(--danger-color); }

.stat-title {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-color);
}

/* ============================================
   TABLES - RESPONSIVE
   ============================================ */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.table th {
    background: var(--light-bg);
    color: var(--primary-color);
    font-weight: bold;
    white-space: nowrap;
}

.table tr:hover {
    background: rgba(78, 115, 223, 0.05);
}

.table img {
    max-width: 40px;
    height: auto;
    border-radius: 50%;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    padding: 10px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success-color); color: #fff; }
.btn-success:hover { background: #16a085; }

.btn-danger { background: var(--danger-color); color: #fff; }
.btn-danger:hover { background: #c0392b; }

.btn-info { background: var(--info-color); color: #fff; }
.btn-info:hover { background: #2b9aad; }

.btn-warning { background: var(--warning-color); color: #333; }
.btn-warning:hover { background: #e8b923; }

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.1);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234e73df' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Dropdown styling for attendance periods */
.period1-dropdown,
.period2-dropdown {
    transition: all 0.3s ease;
    font-weight: 500;
}

.period1-dropdown:hover,
.period2-dropdown:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.period1-dropdown:focus,
.period2-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.1);
}

/* Badge Styling */
.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Code Block Styling */
code {
    background: var(--light-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #d63384;
}

input[type="radio"],
input[type="checkbox"] {
    cursor: pointer;
    margin-right: 5px;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: var(--info-color);
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: var(--success-color);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: var(--warning-color);
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left-color: var(--danger-color);
}

/* ============================================
   UTILITIES
   ============================================ */

.d-flex {
    display: flex;
}

.d-sm-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.mb-4 {
    margin-bottom: 20px;
}

.mb-0 {
    margin-bottom: 0;
}

.text-gray-800 {
    color: #2e3338;
}

.h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.h1 {
    font-size: 2rem;
    font-weight: 700;
}

.rounded-circle {
    border-radius: 50%;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 15px;
}

.mt-4 {
    margin-top: 20px;
}

/* ============================================
   DASHBOARD GRID - RESPONSIVE
   ============================================ */

.row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.row.two-col {
    grid-template-columns: 1fr;
}

.row.four-col {
    grid-template-columns: 1fr;
}

/* ============================================
   MEDIA QUERIES - TABLET (768px+)
   ============================================ */

@media (min-width: 768px) {
    .wrapper {
        flex-direction: row;
    }

    #sidebar {
        position: relative;
        transform: translateX(0);
        width: 250px;
        height: auto;
        min-height: 100vh;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    #sidebar.active {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    #sidebarCollapse {
        display: none;
    }

    #content {
        flex: 1;
        width: calc(100% - 250px);
    }

    .main-content {
        padding: 20px;
    }

    .navbar {
        padding: 15px 20px;
        margin-bottom: 30px;
    }

    .user-info span {
        overflow: visible;
        text-overflow: clip;
    }

    .row.two-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .row.four-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .table {
        font-size: 0.95rem;
    }

    .table th,
    .table td {
        padding: 15px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .card-body {
        padding: 20px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.95rem;
    }
}

/* ============================================
   MEDIA QUERIES - DESKTOP (1024px+)
   ============================================ */

@media (min-width: 1024px) {
    .main-content {
        padding: 30px;
    }

    .row.four-col {
        grid-template-columns: repeat(4, 1fr);
    }

    .row.two-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .card {
        margin-bottom: 25px;
    }

    .stat-value {
        font-size: 2rem;
    }

    .h3 {
        font-size: 1.75rem;
    }

    .navbar {
        padding: 20px 30px;
        margin-bottom: 30px;
    }

    .table {
        font-size: 1rem;
    }

    .table th,
    .table td {
        padding: 18px;
    }
}

/* ============================================
   MEDIA QUERIES - LARGE DESKTOP (1200px+)
   ============================================ */

@media (min-width: 1200px) {
    .main-content {
        padding: 30px 40px;
    }

    .row.four-col {
        grid-template-columns: repeat(4, 1fr);
    }

    .row.two-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .card {
        margin-bottom: 30px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    #sidebar,
    .navbar,
    #sidebarCollapse,
    .btn {
        display: none !important;
    }

    #content {
        width: 100%;
    }

    .main-content {
        padding: 0;
    }

    .card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}


