/* =============================================
   Sistema de Control de Asistencia
   Ministerio de Cultura y Deportes de Guatemala
   Diseño minimalista / funcional
   ============================================= */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2c5282;
    --primary-dark: #1a365d;
    --primary-light: #ebf4ff;
    --success: #276749;
    --success-bg: #f0fff4;
    --danger: #c53030;
    --danger-bg: #fed7d7;
    --warning: #c05621;
    --warning-bg: #fffaf0;
    --info: #2b6cb0;
    --info-bg: #ebf8ff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --bg: #f7fafc;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --radius: 6px;
}

html {
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--primary-dark);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.sidebar-header small {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.sidebar-nav {
    padding: 0.75rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    font-weight: 500;
}

.sidebar-nav .nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.8rem;
}

.sidebar-footer .user-info {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.sidebar-footer .user-role {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-footer a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.sidebar-footer a:hover {
    color: var(--white);
}

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

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

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-dark);
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--bg);
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-body {
    padding: 1rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

thead th {
    background: var(--bg);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover {
    background: var(--primary-light);
}

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

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

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

.form-control {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
}

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

.form-control:disabled,
.form-control[readonly] {
    background: #edf2f7;
    cursor: not-allowed;
    opacity: 0.7;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

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

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

.btn-success:hover {
    background: #22543d;
}

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

.btn-danger:hover {
    background: #9b2c2c;
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: #9c4221;
}

.btn-outline {
    background: var(--white);
    color: var(--text);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--text-light);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
}

/* Badges / Status */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-neutral {
    background: #edf2f7;
    color: var(--text-light);
}

/* Alerts / Flash Messages */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: #c6f6d5;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #feb2b2;
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: #feebc8;
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: #bee3f8;
}

/* Search / Filter bar */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    max-width: 250px;
}

.filter-bar select.form-control {
    max-width: 180px;
}

/* Stats / Summary cards */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    flex: 1;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.stat-card .stat-detail {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Profile section */
.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}

.profile-info .profile-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

.profile-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Attendance indicator */
.attendance-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.3rem;
}

.attendance-dot.present {
    background: var(--success);
}

.attendance-dot.absent {
    background: var(--danger);
}

.attendance-dot.pending {
    background: #e2e8f0;
}

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

.login-box h1 {
    font-size: 1.2rem;
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
}

.login-box .login-subtitle {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.login-box .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 0.6rem;
    font-size: 0.95rem;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .stats-row {
        flex-direction: column;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}
