/* IEVI Portal CSS - Estilo Moderno y Profesional */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #007dc3;
    --primary-hover: #0065a0;
    --primary-light: rgba(0, 125, 195, 0.08);
    --primary-dark: #004d7a;
    
    --bg-color: #faf6ee; /* Crema suave */
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e6dfd5; /* Borde crema suave */
    
    /* Variables de la barra lateral en Modo Claro (Crema) */
    --sidebar-bg: #f5eedf; /* Crema más oscuro para contraste */
    --sidebar-text: #5d6770;
    --sidebar-hover: #eadecd;
    --sidebar-hover-text: #1e293b;
    --sidebar-active: #007dc3;
    --sidebar-active-text: #ffffff;
    --sidebar-logo-text: #1e293b;
    --sidebar-user-name: #1e293b;
    --sidebar-border: rgba(0, 0, 0, 0.08);

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    
    /* Variables de la barra lateral en Modo Oscuro (Gris Oscuro/Azulado) */
    --sidebar-bg: #0b0f19;
    --sidebar-text: #8c9ba5;
    --sidebar-hover: #1e293b;
    --sidebar-hover-text: #ffffff;
    --sidebar-active: #007dc3;
    --sidebar-active-text: #ffffff;
    --sidebar-logo-text: #ffffff;
    --sidebar-user-name: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    font-weight: 600;
}

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

a:hover {
    color: var(--primary-hover);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 2rem;
}

.sidebar-logo i {
    font-size: 1.75rem;
    color: var(--primary);
}

.sidebar-logo span {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sidebar-logo-text);
    letter-spacing: 0.5px;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-item a:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
}

.sidebar-item.active a {
    background-color: var(--sidebar-active);
    color: var(--sidebar-active-text);
    box-shadow: 0 4px 10px rgba(0, 125, 195, 0.3);
}

.sidebar-item a i {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding-top: 1rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-light);
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sidebar-user-name);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Evita que crezca más allá del flex container */
    padding: 2rem;
    overflow-y: auto;
}

/* Top bar / Header inside content */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(15deg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
}

.btn-secondary {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

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

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

.btn-danger:hover {
    background-color: #d32f2f;
}

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

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

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background-color: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Card General */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.01);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Forms & Filters */
.filter-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-control, select, textarea {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    color: var(--text-color);
    outline: none;
    transition: var(--transition);
    width: 100%;
}

.form-control:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table th {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-info {
    background-color: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-neutral {
    background-color: var(--border-color);
    color: var(--text-color);
}

/* Grid layout for Course/Equipment Form */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .form-grid-2, .form-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 1rem;
    }
    
    .sidebar-logo {
        margin-bottom: 1rem;
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .sidebar-item a {
        padding: 0.5rem 0.8rem;
        white-space: nowrap;
    }
    
    .sidebar-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .main-content {
        padding: 1rem;
    }
}

/* Styles specifically mirroring the user form mockup */
.form-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.checkbox-group, .radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.5rem 0;
}

.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input, .radio-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* File Upload drag area styled */
.file-upload-wrapper {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    background-color: var(--bg-color);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.file-upload-wrapper:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.file-upload-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-upload-text strong {
    color: var(--primary);
}

.file-info-badge {
    background-color: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Login styling */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-logo {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.login-logo i {
    font-size: 3rem;
    color: var(--primary);
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
}

.login-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Alert Styling */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    font-size: 0.9rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    display: flex;
    align-items: center;
}

.btn-close:hover {
    opacity: 1;
}

/* Actions menu */
.actions-cell {
    display: flex;
    gap: 0.5rem;
}

/* Column Manager Popover */
.col-manager-popover {
    display: none;
    position: absolute;
    z-index: 1050;
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-color);
    animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .col-manager-popover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes popoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.col-manager-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
}

.col-manager-reset {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.col-manager-reset:hover {
    background: rgba(0, 125, 195, 0.1);
}

.col-manager-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom Webkit scrollbar for popover list */
.col-manager-list::-webkit-scrollbar {
    width: 6px;
}
.col-manager-list::-webkit-scrollbar-track {
    background: transparent;
}
.col-manager-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.col-manager-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid transparent;
    transition: all 0.2s;
}

[data-theme="dark"] .col-manager-item {
    background: rgba(255, 255, 255, 0.02);
}

.col-manager-item:hover {
    border-color: rgba(0, 125, 195, 0.2);
    background: rgba(0, 125, 195, 0.03);
}

.col-manager-item-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.col-manager-arrows {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.col-manager-arrow-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 1px 3px;
    cursor: pointer;
    border-radius: 2px;
    line-height: 1;
    transition: all 0.1s;
}

.col-manager-arrow-btn:hover {
    color: var(--primary);
    background: rgba(0, 125, 195, 0.15);
}

/* Modern Switch Button style */
.pro-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

.pro-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pro-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 20px;
}

[data-theme="dark"] .pro-slider {
    background-color: #475569;
}

.pro-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .pro-slider {
    background-color: var(--primary);
}

input:checked + .pro-slider:before {
    transform: translateX(18px);
}

/* Table Column Sorting Header Styles */
th[data-column] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 28px !important;
    transition: background-color 0.2s ease;
}

th[data-column]:not([data-column="acciones"]):hover {
    background-color: rgba(0, 125, 195, 0.08) !important;
}

.sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    transition: all 0.2s;
}

/* Details Modal Overlay and Box Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px) saturate(180%);
    -webkit-backdrop-filter: blur(8px) saturate(180%);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: modalFadeIn 0.2s ease-out;
}

.modal-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-color);
}

[data-theme="dark"] .modal-container {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.detail-section {
    background: rgba(0, 0, 0, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

[data-theme="dark"] .detail-section {
    background: rgba(255, 255, 255, 0.015);
}

.detail-section:last-child {
    margin-bottom: 0;
}


