@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --secondary-hover: #475569;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --info: #0ea5e9;

    /* Neutral Colors - Light Mode */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --topbar-bg: #ffffff;

    /* Shadows & Effects */
    --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);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-blur: blur(12px);

    /* Borders */
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

[data-theme="dark"] {
    --bg-body: #020617;
    --bg-card: #0f172a;
    --bg-sidebar: #020617;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    --topbar-bg: #0f172a;
    --glass-bg: rgba(15, 23, 42, 0.8);
    
    /* Dark specific adjustments */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

/* Base Reset */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    color: white;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: 72px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar.collapsed .sidebar-header h2 {
    display: none;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-nav li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-nav li a.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar-nav .icon {
    font-size: 1.25rem;
    min-width: 24px;
    margin-right: 12px;
}

.sidebar.collapsed .sidebar-nav .label {
    display: none;
}

.sidebar.collapsed .sidebar-nav li a {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-nav .icon {
    margin-right: 0;
}

/* User Info in Sidebar */
.user-info {
    padding: 1rem;
    margin: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.user-info strong {
    color: white;
}

.user-info .text-white-50 {
    color: #94a3b8 !important;
}

/* Submenu Styles */
.sidebar-nav .submenu {
    display: none;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin: 4px 0 8px 12px;
}

.sidebar-nav li.open .submenu {
    display: block;
}

.sidebar-nav .submenu li a {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
}

/* Main Content Layout */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: calc(100% - 250px);
    box-sizing: border-box;
    min-width: 0; /* Prevent flex overflow */
}

.main-content.expanded {
    margin-left: 72px;
    width: calc(100% - 72px);
}

.main-content.full-width {
    margin-left: 0;
    width: 100%;
    padding: 0;
}

@media (max-width: 1024px) {
    .main-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        left: -250px;
        transition: left 0.3s ease;
    }
    
    .sidebar.mobile-active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }
    
    .main-content.expanded {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    right: 0;
    z-index: 900;
    background: var(--topbar-bg);
    padding: 0.75rem 2.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin: -2.5rem -2.5rem 2rem -2.5rem; /* Offset main-content padding */
}

.user-menu-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.user-menu-info {
    text-align: right;
    line-height: 1.2;
}

.user-menu-info strong {
    display: block;
    font-size: 0.875rem;
    color: var(--text-main);
}

.user-menu-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-link {
    color: var(--danger);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.logout-link:hover {
    background: #fef2f2;
}
.main-header {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.main-header h1 {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

/* Cards */
.card,
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card {
    border-left: 4px solid var(--primary);
}

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

/* Stats Components */
.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.stat-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Tables - Premium Style */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th {
    background-color: var(--bg-body);
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: var(--bg-body);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

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

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

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

.btn-success:hover {
    background: var(--success-hover);
}

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

.btn-danger:hover {
    background: var(--danger-hover);
}

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

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.close-modal:hover {
    color: var(--danger);
}

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

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-body);
    border-color: #cbd5e1;
}

/* Forms */
.form-control,
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s;
    color: var(--text-main);
}

/* Inputs en modo oscuro */
[data-theme="dark"] input, 
[data-theme="dark"] select, 
[data-theme="dark"] textarea {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] input:focus, 
[data-theme="dark"] select:focus {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.form-control:focus,
input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

/* Utiltities */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #e0f2fe;
    color: #075985;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Grid System */
.grid {
    display: grid;
    gap: 1.5rem;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Responsive Grid & Layout */
@media (max-width: 1024px) {
    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .main-header {
        padding: 1.5rem;
    }

    .main-header h1 {
        font-size: 1.5rem;
    }
    
    .top-bar {
        margin: -1rem -1rem 1rem -1rem !important; /* Match mobile padding */
    }
}
/* Tab System */
.tabs-container {
    margin-top: 2rem;
}

.tabs-header {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    padding-bottom: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs-header::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* Form Helper Classes */
.input-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dynamic-list-item {
    padding: 1rem;
    background: var(--bg-body);
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    justify-content: space-between;
    align-items: center;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border-left: 6px solid #cbd5e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
    transition: all 0.3s ease;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }

.toast-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

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

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    opacity: 0.5;
}

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

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: scale(0.95); }
}

/* Alerts / Flash Messages */
.alert {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    border-left: 5px solid #cbd5e1;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.4s ease-out;
}

.alert-danger, .alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #ef4444;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

.alert-info, .alert-warning {
    background-color: #e0f2fe;
    color: #075985;
    border-color: #0ea5e9;
}

[data-theme="dark"] .alert-danger, [data-theme="dark"] .alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: #ef4444;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border-color: #10b981;
}

[data-theme="dark"] .alert-info, [data-theme="dark"] .alert-warning {
    background-color: rgba(14, 165, 233, 0.1);
    color: #7dd3fc;
    border-color: #0ea5e9;
}

/* Student Portal Responsive Adjustments */
.portal-container {
    padding: 0 2.5rem;
}

.welcome-banner {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); 
    border-radius: 24px; 
    padding: 3rem; 
    color: white; 
    position: relative; 
    overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.welcome-banner-flex {
    display: flex; gap: 1rem; margin-top: 1.5rem;
}

.portal-header-flex {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
}

.portal-profile-row {
    display: flex; gap: 2rem; flex-wrap: wrap;
}

.portal-card {
    background: white; border-radius: 20px; padding: 2rem; border: 1px solid var(--border-color); transition: transform 0.3s ease, box-shadow 0.3s ease; cursor: pointer;
}

[data-theme="dark"] .portal-card {
    background: var(--bg-card);
}

[data-theme="dark"] .welcome-banner {
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .portal-container {
        padding: 0;
    }
    .welcome-banner {
        padding: 1.5rem;
        border-radius: 16px;
    }
    .welcome-banner h1 {
        font-size: 1.75rem !important;
    }
    .welcome-banner-flex {
        flex-direction: column;
    }
    .portal-header-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    .portal-card {
        padding: 1.5rem;
    }
    .portal-profile-row {
        flex-direction: column;
        gap: 1rem;
    }
    .portal-profile-row > div {
        max-width: 100% !important;
        min-width: 100% !important;
    }

    /* Admin top-bar and user menu mobile adjustments */
    .mobile-only-toggle {
        display: inline-flex !important;
    }
    
    .user-menu-top {
        gap: 0.5rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    .period-selector-label {
        display: none !important;
    }
    
    .period-selector-container {
        margin-right: 5px !important;
    }
    
    .switch-role-btn {
        margin-right: 5px !important;
        padding: 4px 10px !important;
        font-size: 0.7rem !important;
    }
    
    .btn-text-desktop {
        display: none !important;
    }
    
    .btn-text-mobile {
        display: inline !important;
    }
    
    .user-name-text,
    .user-role-text,
    .user-menu-divider {
        display: none !important;
    }
    
    .user-icon-badge {
        font-size: 1.25rem !important;
    }

    /* Ocultar tabla de escritorio y mostrar tarjetas de móvil */
    .desktop-only-view {
        display: none !important;
    }
    
    .mobile-cards-view {
        display: flex !important;
        flex-direction: column;
        gap: 1.25rem;
        width: 100%;
        margin-top: 1rem;
    }
    
    /* Estilos Premium de Tarjetas */
    .student-card, .teacher-card {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 1.25rem;
        box-shadow: var(--shadow-sm);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        cursor: pointer;
    }
    
    .student-card:active, .teacher-card:active {
        transform: scale(0.98);
        box-shadow: none;
    }
    
    /* Color de borde izquierdo según estatus */
    .student-card.status-activo, .teacher-card.status-activo {
        border-left: 4px solid var(--success) !important;
    }
    .student-card.status-suspendido, .teacher-card.status-baja {
        border-left: 4px solid var(--warning) !important;
    }
    .student-card.status-baja, .teacher-card.status-inactivo {
        border-left: 4px solid var(--danger) !important;
    }
    
    /* Estilos de cabecera de tarjeta */
    .student-card-header, .teacher-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed var(--border-color);
        padding-bottom: 0.5rem;
    }
    
    .student-card-matricula {
        font-family: monospace;
        font-weight: 700;
        color: var(--primary);
        font-size: 0.95rem;
    }
    
    .student-card-name, .teacher-card-name {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--text-main);
        line-height: 1.3;
    }
    
    /* Cuerpo y Filas de Información */
    .student-card-body, .teacher-card-body {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .student-card-info-row, .teacher-card-info-row {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        font-size: 0.875rem;
    }
    
    .info-label {
        color: var(--text-muted);
        font-weight: 500;
    }
    
    .info-value {
        color: var(--text-main);
        font-weight: 600;
        text-align: right;
    }
    
    /* Grid compacto de meta */
    .student-card-grid-meta {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        background: var(--bg-body);
        padding: 0.5rem;
        border-radius: 8px;
        text-align: center;
        margin-top: 4px;
    }
    
    .student-card-grid-meta div {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    
    .student-card-grid-meta .info-label {
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
    
    .student-card-grid-meta .info-value {
        font-size: 0.85rem;
        text-align: center;
        color: var(--text-main);
        font-weight: 600;
    }
    
    /* Pie y botones de acción rápidos en móvil */
    .student-card-actions, .teacher-card-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 0.5rem;
        border-top: 1px solid var(--border-color);
        padding-top: 0.75rem;
    }
    
    .student-card-actions .btn, .teacher-card-actions .btn,
    .student-card-actions a, .teacher-card-actions a {
        flex: 1 1 calc(50% - 6px); /* 2 botones por fila */
        font-size: 0.75rem !important;
        padding: 8px 10px !important;
        border-radius: 8px !important;
        justify-content: center;
        box-sizing: border-box;
    }
    
    /* Scroll Horizontal de Filtros */
    .status-filters {
        display: flex !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
        scrollbar-width: none; /* Firefox */
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .status-filters::-webkit-scrollbar {
        display: none; /* Safari / Chrome */
    }
    
    /* Controles de cabecera apilados en móvil */
    .students-header, .main-header {
        padding: 1rem !important;
        gap: 1rem !important;
    }
    
    .header-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        width: 100%;
    }
    
    .search-form {
        width: 100% !important;
        display: flex;
        gap: 8px;
    }
    
    .search-box {
        flex: 1;
        min-width: 0 !important;
    }
    
    .action-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .action-buttons .btn, .action-buttons button {
        width: 100% !important;
        margin: 0 !important;
        font-size: 0.8rem !important;
        padding: 8px 12px !important;
    }
    
    /* Ajustes para previsualización modal y modales generales */
    .modal-content-card {
        padding: 1.5rem !important;
        margin: 15% auto !important;
        border-radius: 16px !important;
    }
    
    .modal-preview-header {
        padding: 1.5rem !important;
    }
    
    .modal-preview-header h2 {
        font-size: 1.5rem !important;
    }
    
    .profile-photo-preview {
        width: 80px !important;
        height: 80px !important;
    }
    
    .modal-preview-header + div {
        padding: 1.5rem !important;
    }
    
    .modal-preview-header + div > div {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    #preview-edit-link, .modal-preview-header + div button {
        padding: 12px !important;
        font-size: 0.95rem !important;
    }

    /* Standard modal content adaptations */
    .modal-content {
        padding: 1.25rem !important;
        width: 95% !important;
        margin: 5% auto !important;
    }

    /* Stack flex-row-responsive items on mobile */
    .flex-row-responsive {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    
    .flex-row-responsive > button,
    .flex-row-responsive > a,
    .flex-row-responsive > div {
        width: 100% !important;
    }

    /* Tabs responsive scroll in mobile */
    .tabs-header {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        scrollbar-width: none; /* Firefox */
        width: 100% !important;
        box-sizing: border-box;
    }
    .tabs-header::-webkit-scrollbar {
        display: none; /* Safari / Chrome */
    }
}

/* Utility responsive flex row */
.flex-row-responsive {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Tabs responsive scrolling support */
.tabs-header {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}
.tab-btn {
    flex-shrink: 0;
}

