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

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --secondary: #00b4d8;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --light: #ffffff;
    --background: #f0f4f8;
    --dark: #2d3748;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--dark);
    min-height: 100vh;
    padding: 20px;
}

.container {
    margin: 0 auto;
}

.header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    color: var(--primary);
    font-size: 2.5em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header h1::before {
    content: "⚕️";
    font-size: 1.2em;
}

.header p {
    color: #666;
    font-size: 1.1em;
}

.header .logout-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: #666;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.header .logout-btn:hover {
    background: #f8fafc;
    color: var(--danger);
    border-color: var(--danger);
}

.main-content {
    display: block;
}

.registro-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.registro-modal.active {
    display: flex;
}

.registro-modal .modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.registro-modal .modal-header {
    background: var(--primary);
    color: white;
    padding: 20px 30px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.registro-modal .modal-header h2 {
    margin: 0;
    padding: 0;
    border: none;
    color: white;
    font-size: 1.5em;
}

.registro-modal .close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
}

.registro-modal .modal-body {
    padding: 30px;
    overflow-y: auto;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.card h2 {
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--secondary);
    font-size: 1.5em;
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 600;
    font-size: 0.95em;
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1em;
    transition: all 0.3s;
    font-family: inherit;
    background-color: #f8fafc;
    color: var(--dark);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

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

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(44, 95, 141, 0.3);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 8px 15px;
    font-size: 0.9em;
}

.btn-edit {
    background: var(--warning);
    color: var(--dark);
    padding: 8px 15px;
    font-size: 0.9em;
    margin-right: 5px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 8px;
}

.tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    color: #64748b;
}

.tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--light);
    border-radius: 8px;
}

.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

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

th {
    background: #f8fafc;
    color: #4a5568;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

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

.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.badge-estudiante {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-docente {
    background: #f3e5f5;
    color: #7b1fa2;
}

.actions {
    display: flex;
    gap: 5px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    color: var(--dark);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card h3 {
    font-size: 0.9em;
    color: #718096;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-card .number {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--primary);
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

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

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

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    border: 4px solid var(--light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.3;
}

#otraCausaGroup {
    display: none;
}

#salidaColegioGroup {
    display: none;
    border: 2px solid var(--warning);
    padding: 20px;
    border-radius: 8px;
    background: #fff9e6;
    margin-top: 20px;
}

#salidaColegioGroup h3 {
    color: var(--warning);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#salidaColegioGroup h3::before {
    content: "⚠️";
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 10px;
    }

    .header .logout-btn {
        position: static;
        margin-top: 15px;
    }
}

.print-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.print-modal.active {
    display: flex;
}

.print-content {
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.print-header-modal {
    background: var(--primary);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.print-close {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
}

.print-body {
    padding: 40px;
}

.print-actions {
    padding: 20px 30px;
    background: var(--light);
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    border-top: 2px solid var(--border);
}

@media print {
    body * {
        visibility: hidden;
    }

    #printArea, #printArea * {
        visibility: visible;
    }

    #printArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .print-actions {
        display: none !important;
    }
}
