:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --danger: #ef4444;
}

html {
    background-color: var(--bg);
    color: var(--text-main);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Nav Desktop Predeterminado */
.topbar {
    width: 100%;
    box-sizing: border-box;
    background: rgba(30, 41, 59, 0.95);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.topbar .brand {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.05em;
}

.nav {
    display: flex;
    flex-direction: row;
    gap: 1.25rem;
    align-items: center;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
}

.nav a:hover, .nav a.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.nav .logout {
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.nav .logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Cards Desktop */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 1rem;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.5rem;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

input[type="text"], input[type="password"], input[type="date"], input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    color-scheme: dark;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.nowrap {
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn.btn-block {
    width: 100%;
}

/* Login specific */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(20px);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.empty-state {
    padding: 4rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

/* Select inputs */
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    box-sizing: border-box;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-master {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.badge-instructor {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.badge-visualizador {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.4);
}

.badge-active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-blocked {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Button Variants */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-secondary {
    background: rgba(51, 65, 85, 0.8);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.4);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Grid layout for profile forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* Tab Navigation */
.tab-header {
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Avatar Component */
.avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

/* ==========================================
   MEDIA QUERIES APORTANDO ADAPTABILIDAD SIN AFECTAR DESKTOP
   ========================================== */

@media (max-width: 768px) {
    .topbar {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .nav {
        overflow-x: auto;
        white-space: nowrap;
        gap: 0.5rem;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .nav a {
        padding: 0.4rem 0.75rem;
        font-size: 0.875rem;
        flex-shrink: 0;
    }

    .container {
        padding: 1rem 0.75rem;
    }

    .card {
        padding: 1.25rem 1rem;
        border-radius: 12px;
    }

    th, td {
        padding: 0.75rem 0.6rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .tab-header {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        flex-shrink: 0;
        padding: 0.6rem 0.875rem;
        font-size: 0.875rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

 / *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
       R E S P O N S I V E   T A B L E S   ( M O B I L E   C A R D   L A Y O U T ) 
       = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   * / 
 @ m e d i a   ( m a x - w i d t h :   7 6 8 p x )   { 
         . t a b l e - r e s p o n s i v e   t a b l e   { 
                 b o r d e r :   0 ; 
         } 
         . t a b l e - r e s p o n s i v e   t h e a d   { 
                 d i s p l a y :   n o n e ; 
         } 
         . t a b l e - r e s p o n s i v e   t r   { 
                 d i s p l a y :   b l o c k ; 
                 m a r g i n - b o t t o m :   1 r e m ; 
                 b a c k g r o u n d :   r g b a ( 1 5 , 2 3 , 4 2 , 0 . 4 ) ; 
                 b o r d e r :   1 p x   s o l i d   v a r ( - - b o r d e r ) ; 
                 b o r d e r - r a d i u s :   8 p x ; 
                 b o x - s h a d o w :   0   2 p x   4 p x   r g b a ( 0 , 0 , 0 , 0 . 1 ) ; 
         } 
         . t a b l e - r e s p o n s i v e   t d   { 
                 d i s p l a y :   f l e x ; 
                 j u s t i f y - c o n t e n t :   s p a c e - b e t w e e n ; 
                 a l i g n - i t e m s :   c e n t e r ; 
                 t e x t - a l i g n :   r i g h t ; 
                 b o r d e r - b o t t o m :   1 p x   s o l i d   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 0 5 ) ; 
                 p a d d i n g :   0 . 7 5 r e m   1 r e m ; 
                 f o n t - s i z e :   0 . 9 r e m ; 
                 w h i t e - s p a c e :   n o r m a l ; 
         } 
         . t a b l e - r e s p o n s i v e   t d : l a s t - c h i l d   { 
                 b o r d e r - b o t t o m :   0 ; 
         } 
         . t a b l e - r e s p o n s i v e   t d : : b e f o r e   { 
                 c o n t e n t :   a t t r ( d a t a - l a b e l ) ; 
                 f o n t - w e i g h t :   6 0 0 ; 
                 t e x t - t r a n s f o r m :   u p p e r c a s e ; 
                 f o n t - s i z e :   0 . 7 5 r e m ; 
                 c o l o r :   v a r ( - - t e x t - m u t e d ) ; 
                 t e x t - a l i g n :   l e f t ; 
                 m a r g i n - r i g h t :   1 r e m ; 
                 f l e x - s h r i n k :   0 ; 
         } 
 } 
 
 / *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
       P R I N T   S T Y L E S 
       = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   * / 
 @ m e d i a   p r i n t   { 
         b o d y   { 
                 b a c k g r o u n d :   # f f f f f f   ! i m p o r t a n t ; 
                 c o l o r :   # 0 0 0 0 0 0   ! i m p o r t a n t ; 
         } 
         . t o p b a r ,   . b t n - p r i m a r y ,   . b t n - s e c o n d a r y ,   . b t n - d a n g e r ,   . m o d a l ,   . t a b - h e a d e r ,   b u t t o n   { 
                 d i s p l a y :   n o n e   ! i m p o r t a n t ; 
         } 
         . c a r d ,   . t a b l e - r e s p o n s i v e   t r   { 
                 b o r d e r :   1 p x   s o l i d   # c c c   ! i m p o r t a n t ; 
                 b a c k g r o u n d :   n o n e   ! i m p o r t a n t ; 
                 b o x - s h a d o w :   n o n e   ! i m p o r t a n t ; 
                 c o l o r :   # 0 0 0   ! i m p o r t a n t ; 
         } 
         t h   { 
                 c o l o r :   # 0 0 0   ! i m p o r t a n t ; 
                 b o r d e r - b o t t o m :   2 p x   s o l i d   # 0 0 0   ! i m p o r t a n t ; 
         } 
         t d   { 
                 b o r d e r - b o t t o m :   1 p x   s o l i d   # d d d   ! i m p o r t a n t ; 
                 c o l o r :   # 0 0 0   ! i m p o r t a n t ; 
         } 
         . b a d g e   { 
                 b o r d e r :   1 p x   s o l i d   # 0 0 0   ! i m p o r t a n t ; 
                 c o l o r :   # 0 0 0   ! i m p o r t a n t ; 
                 b a c k g r o u n d :   n o n e   ! i m p o r t a n t ; 
         } 
         c a n v a s   { 
                 m a x - w i d t h :   1 0 0 %   ! i m p o r t a n t ; 
         } 
         . c o n t a i n e r   { 
                 p a d d i n g :   0   ! i m p o r t a n t ; 
                 m a r g i n :   0   ! i m p o r t a n t ; 
                 m a x - w i d t h :   1 0 0 %   ! i m p o r t a n t ; 
         } 
         @ p a g e   { 
                 m a r g i n :   1 . 5 c m ; 
         } 
 } 
  
 