/* ======================================
   SMS Attendance System - Styles
   Centro Educativo SMS
   ====================================== */

:root {
    --primary: #0f4c75;
    --primary-light: #1b6ca8;
    --primary-dark: #092e45;
    --accent: #3fc1c9;
    --accent-light: #e0f7fa;

    --green: #2e7d32;
    --green-bg: #e8f5e9;
    --green-border: #a5d6a7;
    --yellow: #ef8c00;
    --yellow-bg: #fff8e1;
    --yellow-border: #ffe082;
    --red: #c62828;
    --red-bg: #ffebee;
    --red-border: #ef9a9a;

    --sidebar-width: 260px;
    --topbar-height: 56px;

    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1a2332;
    --text-secondary: #5f6b7a;
    --border: #e2e8f0;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'DM Sans', sans-serif;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 10px;
    --radius-lg: 14px;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 0.9rem;
}

h1, h2, h3, h4, h5, h6, .fw-heading {
    font-family: var(--font-heading);
}

a { text-decoration: none; }

/* ---- Login Page ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 100%);
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    animation: fadeInUp 0.5s ease;
}

.login-card .logo-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: white;
    margin: 0 auto 1.2rem;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 0.25rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.8rem;
    font-size: 0.85rem;
}

.form-floating > .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,76,117,0.12);
}

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    color: white;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-family: var(--font-heading);
    transition: all 0.2s;
    width: 100%;
}

.btn-primary-custom:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.sidebar-header h5 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
}

.sidebar-header small {
    color: rgba(255,255,255,0.5) !important;
    font-size: 0.7rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0.75rem 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav .nav-section {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: rgba(255,255,255,0.65);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

.sidebar-nav a.active {
    color: #fff;
    background: rgba(63,193,201,0.12);
    border-left-color: var(--accent);
}

.sidebar-nav a i {
    font-size: 1.1rem;
    width: 1.3rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

/* ---- Mobile Topbar ---- */
.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--primary-dark);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    z-index: 1030;
    font-family: var(--font-heading);
    font-weight: 600;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 1.5rem;
}

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

.content-header h4 {
    font-weight: 700;
    color: var(--primary-dark);
}

/* ---- Cards ---- */
.card-custom {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
}

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

.card-custom .card-body {
    padding: 1.25rem;
}

/* Stat cards */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.yellow { background: var(--yellow-bg); color: var(--yellow); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-icon.blue { background: #e3f2fd; color: var(--primary); }

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* ---- Tables ---- */
.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th {
    background: var(--bg);
    padding: 0.65rem 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 0.85rem;
}

.table-custom tbody tr:hover {
    background: rgba(15,76,117,0.02);
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.green {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.status-badge.yellow {
    background: var(--yellow-bg);
    color: var(--yellow);
    border: 1px solid var(--yellow-border);
}

.status-badge.red {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.status-badge.justified {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

/* ---- Attendance specific ---- */
.attendance-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: all 0.15s;
}

.attendance-row:hover {
    box-shadow: var(--shadow-sm);
}

.attendance-row.status-green { border-left: 4px solid var(--green); }
.attendance-row.status-yellow { border-left: 4px solid var(--yellow); }
.attendance-row.status-red { border-left: 4px solid var(--red); }
.attendance-row.status-justified { border-left: 4px solid #7b1fa2; }

.time-input {
    width: 100px;
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 600;
}

/* ---- Buttons ---- */
.btn-action {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-action.green { background: var(--green-bg); color: var(--green); }
.btn-action.green:hover { background: var(--green); color: white; }
.btn-action.yellow { background: var(--yellow-bg); color: var(--yellow); }
.btn-action.yellow:hover { background: var(--yellow); color: white; }
.btn-action.red { background: var(--red-bg); color: var(--red); }
.btn-action.red:hover { background: var(--red); color: white; }
.btn-action.blue { background: #e3f2fd; color: var(--primary); }
.btn-action.blue:hover { background: var(--primary); color: white; }

/* ---- Notification items ---- */
.notif-item {
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    font-size: 0.83rem;
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--accent-light); border-color: var(--accent); }
.notif-item .notif-time { font-size: 0.7rem; color: var(--text-secondary); }

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    align-items: end;
}

.filter-bar .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-bar label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.filter-bar select, .filter-bar input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
    font-size: 0.83rem;
    background: var(--surface);
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-content {
        margin-left: 0;
        padding-top: calc(var(--topbar-height) + 1rem);
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: calc(var(--topbar-height) + 0.75rem) 0.75rem 0.75rem;
    }
    .stat-card {
        padding: 0.85rem;
    }
    .attendance-row {
        flex-wrap: wrap;
    }
    .filter-bar {
        flex-direction: column;
    }
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }
.fade-in-up { animation: fadeInUp 0.4s ease forwards; }

/* Chart container stability */
canvas {
    display: block;
    max-width: 100%;
}

/* ---- Misc ---- */
.badge-sm {
    font-size: 0.6rem !important;
    padding: 0.2em 0.45em !important;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-w-0 { min-width: 0; }

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

/* Modal overrides */
.modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    font-family: var(--font-heading);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
}
