/* ============================================================
   TREETONE MUSIC ONLINE — PORTAL DE ALUMNOS (BILINGUAL AUTH & REGISTRATION)
   - Dual Mode (Ingresar vs Crear Contraseña)
   - Selector de Idioma en Header (ES / EN)
   - Soporte para Supabase Auth Password Reset & SignUp
   ============================================================ */

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

/* === DARK THEME (DEFAULT) === */
:root, [data-theme="dark"] {
    --bg-main: #0a0a0a;
    --bg-card: #121214;
    --bg-elevated: #1a1a1e;
    
    --brand-gold: #ECA72C;
    --brand-gold-hover: #D48F18;
    --brand-gold-light: rgba(236, 167, 44, 0.1);
    --brand-gold-border: rgba(236, 167, 44, 0.22);
    
    --text-main: #ffffff;
    --text-muted: #9ea0a6;
    --text-subdued: #686a73;
    
    --status-success: #22c55e;
    --status-success-bg: rgba(34, 197, 94, 0.1);
    --status-warning: #f59e0b;
    --status-warning-bg: rgba(245, 158, 11, 0.1);
    --status-danger: #ef4444;
    --status-danger-bg: rgba(239, 68, 68, 0.1);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.6);
    --shadow-gold: 0 4px 16px rgba(236, 167, 44, 0.2);

    --logo-filter: brightness(0) invert(1);
}

/* === LIGHT THEME (ORGANIC ALABASTER) === */
[data-theme="light"] {
    --bg-main: #faf8f5;
    --bg-card: #ffffff;
    --bg-elevated: #f4f1ea;
    
    --brand-gold: #D48F18;
    --brand-gold-hover: #B87A10;
    --brand-gold-light: rgba(212, 143, 24, 0.08);
    --brand-gold-border: rgba(212, 143, 24, 0.25);
    
    --text-main: #18201c;
    --text-muted: #4e5a54;
    --text-subdued: #78857f;
    
    --status-success: #15803d;
    --status-success-bg: rgba(21, 128, 61, 0.08);
    --status-warning: #b45309;
    --status-warning-bg: rgba(180, 83, 9, 0.08);
    --status-danger: #b91c1c;
    --status-danger-bg: rgba(185, 28, 28, 0.08);
    
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.04);
    --shadow-gold: 0 4px 16px rgba(212, 143, 24, 0.2);

    --logo-filter: none;
}

:root {
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --font-heading: 'Oswald', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, .font-heading {
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.sentence-case {
    text-transform: none !important;
}

/* === HEADER & BRAND LOGO === */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 24px;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.header-inner {
    max-width: 1140px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo-img {
    height: 38px;
    width: auto;
    filter: var(--logo-filter);
    transition: filter 0.25s ease;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.container {
    max-width: 1140px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
}

/* === BUTTONS & INPUTS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--brand-gold);
    color: #0a0a0a;
    box-shadow: var(--shadow-gold);
}

.btn-primary:hover {
    background: var(--brand-gold-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--brand-gold-light);
    border-color: var(--brand-gold-border);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

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

.btn-ghost:hover {
    color: var(--text-main);
    background: var(--bg-elevated);
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    border-color: var(--brand-gold);
    color: var(--brand-gold);
}

/* === LOGIN / REGISTRO CARD & TABS === */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-input:focus {
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 3px var(--brand-gold-light);
}

.login-wrapper {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--brand-gold-border);
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-card);
}

.login-header {
    text-align: center;
    margin-bottom: 20px;
}

.login-header h1 {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* PESTAÑAS (TABS) INGRESAR VS CREAR MI CONTRASEÑA */
.auth-tabs {
    display: flex;
    background: var(--bg-elevated);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.auth-tab.active {
    background: var(--bg-card);
    color: var(--brand-gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.forgot-link {
    font-size: 0.82rem;
    color: var(--brand-gold);
    text-decoration: none;
    cursor: pointer;
}

.forgot-link:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

/* === DASHBOARD LAYOUT & CARDS === */
.profile-banner {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

.profile-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.profile-info h1 {
    font-size: 1.9rem;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-gold {
    background: var(--brand-gold-light);
    color: var(--brand-gold);
    border: 1px solid var(--brand-gold-border);
}

.badge-success {
    background: var(--status-success-bg);
    color: var(--status-success);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-neutral {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.profile-links {
    display: flex;
    gap: 8px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1.55fr 1fr;
    }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

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

.card-title {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
}

/* CYCLE STATS */
.progress-container {
    margin: 18px 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--brand-gold);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.cycle-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.stat-box {
    text-align: center;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--brand-gold);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

/* PAYMENT ALERT BAR */
.payment-alert {
    background: var(--status-danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* REGULARITY BARS */
.regularity-card {
    margin-top: 20px;
}

.regularity-bars-wrapper {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-top: 12px;
}

.regularity-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    height: 75px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.regularity-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.regularity-bar-pill {
    width: 100%;
    max-width: 28px;
    border-radius: 4px 4px 0 0;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 12px;
}

.regularity-bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 6px;
}

/* TARJETAS DE HISTORIAL DE CICLOS CON FECHAS DE CLASES VISIBLES DIRECTAMENTE */
.history-container-card {
    margin-top: 20px;
}

.history-scroll-box {
    max-height: 420px;
    overflow-y: auto;
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.history-card-item {
    background: var(--bg-elevated);
    border-left: 3px solid var(--brand-gold);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    transition: background 0.2s ease;
}

.history-card-item:hover {
    background: var(--brand-gold-light);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.history-card-dates {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.history-card-dates strong {
    color: var(--text-main);
}

.history-card-dates span {
    color: var(--brand-gold);
    font-weight: 500;
}

.timeline {
    position: relative;
    padding-left: 16px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 14px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -16px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand-gold);
}

.timeline-date {
    font-size: 0.82rem;
    color: var(--brand-gold);
    font-weight: 600;
}

.timeline-title {
    font-size: 0.88rem;
    font-weight: 600;
}

/* MODAL DE PAGO */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--brand-gold-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    padding: 24px 28px;
    box-shadow: var(--shadow-card);
    position: relative;
    transform: translateY(15px);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

.payment-code-block {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text-main);
    margin-bottom: 18px;
    max-height: 280px;
    overflow-y: auto;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

.wise-link {
    color: var(--brand-gold);
    font-weight: 700;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.wise-link:hover {
    color: var(--brand-gold-hover);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* FOOTER */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 18px;
    text-align: center;
    color: var(--text-subdued);
    font-size: 0.85rem;
    margin-top: auto;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .container {
        padding: 14px 12px;
    }
    .profile-banner {
        padding: 18px;
    }
    .profile-info h1 {
        font-size: 1.5rem;
    }
}
