/* ============================================
   Panel de Administración - Estilos
   ============================================ */

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
}

/* Header */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.admin-header p {
    opacity: 0.9;
    font-size: 14px;
}

/* Navigation */
.admin-nav {
    background: white;
    padding: 15px 40px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 20px;
    align-items: center;
}

.admin-nav a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.admin-nav a:hover {
    color: #764ba2;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 40px;
}

.section-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-icon {
    padding: 8px 12px;
    font-size: 14px;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #4a5568;
    font-size: 14px;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.required-fields {
    background: #fff5f5;
    border-left: 4px solid #f56565;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 13px;
    color: #742a2a;
}

/* Table */
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.users-table th {
    background: #f7fafc;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table td {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    color: #2d3748;
    font-size: 14px;
}

.users-table tr:hover {
    background: #f7fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background: #fed7d7;
    color: #c53030;
}

.badge-profesor {
    background: #bee3f8;
    color: #2c5282;
}

.badge-student {
    background: #c6f6d5;
    color: #22543d;
}

.badge-visitor {
    background: #fef5e7;
    color: #accc3a;
}

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 8px;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border-left: 4px solid #48bb78;
}

.alert-error {
    background: #fed7d7;
    color: #c53030;
    border-left: 4px solid #f56565;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 20px;
    color: #2d3748;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #4a5568;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

/* Facultad Groups (Accordion) */
.facultad-group {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.facultad-header {
    background: #f7fafc;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #2d3748;
    transition: background 0.2s;
    user-select: none;
}

.facultad-header:hover {
    background: #edf2f7;
}

.facultad-header .icon {
    transition: transform 0.3s;
    color: #667eea;
}

.facultad-header.active .icon {
    transform: rotate(90deg);
}

.facultad-carreras {
    padding: 12px 16px;
    background: white;
    display: none;
    border-top: 1px solid #e2e8f0;
}

.facultad-carreras.show {
    display: block;
}

.carreras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

/* Modules Section */
.modules-section {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.modules-section.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-subtitle {
    font-size: 14px;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header,
    .admin-nav,
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

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

    .users-table {
        font-size: 12px;
    }

    .users-table th,
    .users-table td {
        padding: 10px;
    }
}
