/**
 * ESTILOS GENERALES - ADMIN PANEL
 * Sistema RUTA Académica
 */

/* ============================================
   RESET Y VARIABLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5282;
    --secondary-color: #4a5568;
    --success-color: #38a169;
    --danger-color: #e53e3e;
    --warning-color: #dd6b20;
    --info-color: #3182ce;
    --light-bg: #f7fafc;
    --white: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #2d3748;
    --text-muted: #718096;
}

/* ============================================
   LAYOUT GENERAL
   ============================================ */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.8em;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1e3a5f;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #2f855a;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c53030;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #c05621;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: #2c5282;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #2d3748;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

input[readonly] {
    background-color: #f1f1f1;
    cursor: not-allowed;
}

/* ============================================
   TABLAS
   ============================================ */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--primary-color);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 14px;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

tbody tr:hover {
    background-color: #f7fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BADGES Y ESTADOS
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
    text-align: center;
}

.badge-activo,
.badge-active {
    background-color: #c6f6d5;
    color: #22543d;
}

.badge-inactivo,
.badge-inactive {
    background-color: #fed7d7;
    color: #742a2a;
}

.badge-pendiente {
    background-color: #feebc8;
    color: #7c2d12;
}

.badge-aprobado {
    background-color: #c6f6d5;
    color: #22543d;
}

.badge-rechazado {
    background-color: #fed7d7;
    color: #742a2a;
}

.badge-bachiller {
    background-color: #bee3f8;
    color: #2c5282;
}

.badge-tecnico {
    background-color: #fbd38d;
    color: #7c2d12;
}

.badge-tecnologo {
    background-color: #c3dafe;
    color: #2c5282;
}

.badge-curso {
    background-color: #d6bcfa;
    color: #44337a;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #c6f6d5;
    color: #22543d;
    border-left: 4px solid #38a169;
}

.alert-danger {
    background-color: #fed7d7;
    color: #742a2a;
    border-left: 4px solid #e53e3e;
}

.alert-warning {
    background-color: #feebc8;
    color: #7c2d12;
    border-left: 4px solid #dd6b20;
}

.alert-info {
    background-color: #bee3f8;
    color: #2c5282;
    border-left: 4px solid #3182ce;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.card-body {
    color: var(--text-color);
}

/* ============================================
   GRID Y LAYOUTS
   ============================================ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 8px;
    max-width: 800px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: var(--primary-color);
}

.modal-close {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.modal-close:hover {
    color: #000;
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-top: 20px;
}

.pagination button,
.pagination a {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.pagination button:hover,
.pagination a:hover {
    background-color: var(--light-bg);
}

.pagination button.active,
.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ============================================
   LOADING
   ============================================ */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5em;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 10px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
    }
}
