* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f5f7fb;
    color: #1e293b;
}

/* ========== LOGIN ========== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

.login-container {
    width: 100%;
    padding: 1rem;
}

.login-card {
    max-width: 420px;
    margin: 0 auto;
    background: white;
    border-radius: 2rem;
    padding: 2.5rem;
    box-shadow: 0 20px 35px -10px rgba(33,150,243,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: #2196F3;
    margin-bottom: 0.5rem;
}

.login-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    transition: all 0.2s;
}

.input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(33,150,243,0.2);
}

.input-group i {
    color: #94a3b8;
    font-size: 1.2rem;
}

.input-group input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 1rem;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: none;
    padding: 0.9rem;
    border-radius: 1rem;
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(33,150,243,0.4);
}

.login-demo {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

/* ========== DASHBOARD LAYOUT ========== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    box-shadow: 2px 0 12px rgba(33,150,243,0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.logo-area {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.logo-area i {
    font-size: 1.8rem;
    color: #2196F3;
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item i {
    width: 1.5rem;
    font-size: 1.2rem;
}

.nav-item:hover {
    background: #f1f5f9;
    color: #2196F3;
}

.nav-item.active {
    background: rgba(33,150,243,0.1);
    color: #2196F3;
    font-weight: 500;
    border-left: 3px solid #2196F3;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: #ef4444;
    text-decoration: none;
    border-radius: 0.75rem;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #fee2e2;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    transition: margin-left 0.3s ease;
}

.top-header {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 90;
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #475569;
    transition: color 0.2s;
}

.menu-toggle:hover {
    color: #2196F3;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-details {
    text-align: right;
}

.user-name {
    font-weight: 600;
    display: block;
}

.user-role {
    font-size: 0.75rem;
    color: #64748b;
}

.user-avatar {
    position: relative;
    width: 48px;
    height: 48px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid white;
}

/* Content */
.content-wrapper {
    padding: 2rem;
}

.page-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: #1e293b;
    border-left: 4px solid #2196F3;
    padding-left: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(33,150,243,0.15);
}

.stat-card i {
    font-size: 2.5rem;
    color: #2196F3;
}

.stat-info h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.stat-info p {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
}

/* Recent Activity */
.recent-section {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #2196F3;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #f8fafc;
    transition: transform 0.2s;
}

.activity-item:hover {
    transform: translateX(4px);
}

.activity-item i {
    font-size: 1.2rem;
    color: #2196F3;
}

.activity-item small {
    margin-left: auto;
    color: #94a3b8;
    font-size: 0.75rem;
}

/* Form Styles */
.form-card {
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #334155;
}

.form-group label i {
    margin-right: 0.5rem;
    color: #2196F3;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33,150,243,0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ========== TABLA RESPONSIVE MEJORADA ========== */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-container {
    background: white;
    border-radius: 1.5rem;
    padding: 1rem;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Tabla responsive con scroll horizontal en móvil */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

.data-table tr:hover {
    background: rgba(33,150,243,0.04);
}

.actions {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.btn-icon.edit {
    color: #2196F3;
}

.btn-icon.edit:hover {
    background: rgba(33,150,243,0.1);
    transform: scale(1.1);
}

.btn-icon.delete {
    color: #ef4444;
}

.btn-icon.delete:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

/* Vista de tarjetas para móviles (alternativa visual) */
@media (max-width: 768px) {
    .table-container {
        padding: 0.5rem;
    }
    
    /* Mejoramos el scroll horizontal */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 550px;
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem;
    }
    
    /* Indicador de scroll */
    .table-responsive::after {
        content: '← desliza para ver más →';
        display: block;
        text-align: center;
        font-size: 0.7rem;
        color: #94a3b8;
        margin-top: 0.5rem;
        padding: 0.5rem;
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.question-card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 5px 18px -12px rgba(15,23,42,0.2);
    background: #ffffff;
    transition: box-shadow 0.2s;
}

.question-card:hover {
    box-shadow: 0 5px 20px -8px rgba(33,150,243,0.2);
}

.question-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.question-card-header h3 {
    font-size: 1rem;
    margin: 0;
}

.options-list {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.option-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
}

.option-row .option-text {
    width: 100%;
}

.option-correct-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #475569;
}

.full-width {
    grid-column: 1 / -1;
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.success i {
    color: #22c55e;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== MEJORAS ADICIONALES ========== */

/* Botones personalizados */
.btn-outline {
    background: transparent;
    border: 2px solid #2196F3;
    color: #2196F3;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: #2196F3;
    color: white;
}

/* Badges y etiquetas */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(33,150,243,0.1);
    color: #2196F3;
}

.badge-success {
    background: rgba(34,197,94,0.1);
    color: #22c55e;
}

.badge-warning {
    background: rgba(245,158,11,0.1);
    color: #f59e0b;
}

/* Animaciones suaves */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2196F3;
}

/* Responsive General */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .top-header {
        padding: 1rem;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-card {
        padding: 1.5rem;
    }
    
    .page-title {
        font-size: 1.4rem;
    }
    
    .user-details {
        display: none;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .btn-secondary {
        text-align: center;
    }
    
    .activity-item {
        flex-wrap: wrap;
    }
    
    .activity-item small {
        margin-left: 2rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        text-align: center;
        justify-content: center;
    }
}