/* ========================================================
   Alchem.io - Account, Profile & Global Leaderboard Styles
   public/account.css
   ======================================================== */

/* ==== 1. Modal de Perfil Clásico (#profile-modal) ==== */
.profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    background: rgba(11, 14, 20, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 140;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    visibility: visible;
    opacity: 1;
}

.profile-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.profile-modal-content {
    width: 90%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--panel-bg, rgba(15, 23, 42, 0.78));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-elevation, 0 8px 32px rgba(0, 0, 0, 0.45));
    color: var(--text-main, #f8fafc);
    animation: fadeInScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.profile-modal-title {
    font-family: 'Cinzel', serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    background: var(--accent-gradient, linear-gradient(135deg, #38bdf8, #818cf8));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
    transition: color var(--transition-smooth, 0.25s ease);
    font-family: inherit;
}

.profile-modal-close:hover {
    color: var(--text-main, #f8fafc);
}

.profile-modal-alias {
    font-size: 13px;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 20px;
}

.profile-modal-alias span {
    color: var(--accent-blue, #38bdf8);
    font-weight: 700;
}

/* Reutilizado tanto en #profile-modal como en #account-modal (Pestaña "Mi Perfil") */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

@media (max-width: 480px) {
    .profile-stats-grid {
        grid-template-columns: 1fr;
    }
}

.profile-stat-card {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-sm, 8px);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-stat-label {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.profile-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent-blue, #38bdf8);
    line-height: 1.1;
}

.profile-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--panel-border, rgba(255, 255, 255, 0.12));
    padding-top: 16px;
}

.profile-modal-reset {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    transition: background var(--transition-smooth, 0.25s ease), color var(--transition-smooth, 0.25s ease);
    font-family: inherit;
}

.profile-modal-reset:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.profile-modal-hint {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    font-style: italic;
}

/* ==== 2. Modal de Cuenta, Autenticación y Ranking Global (#account-modal) ==== */
.account-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(11, 14, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.account-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.account-modal-content {
    width: 92%;
    max-width: 660px;
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 24px rgba(56, 189, 248, 0.15);
    padding: 24px;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: fadeInScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.account-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
}

.account-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.account-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.account-tab-btn:hover {
    color: #38bdf8;
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(56, 189, 248, 0.3);
}

.account-tab-btn.active {
    color: #0b0e14;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
}

.account-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.account-modal-close:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
}

.account-tab-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 280px;
}

.account-tab-pane.hidden {
    display: none;
}

/* ==== 3. Formulario de Autenticación ==== */
.account-auth-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-auth-intro h3 {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.account-auth-intro p {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.4;
}

.account-auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
}

.account-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #f1f5f9;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-sm, 8px);
    outline: none;
    transition: all 0.2s ease;
}

.account-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
    background: rgba(30, 41, 59, 0.95);
}

.account-auth-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.account-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.account-btn-primary {
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    color: #0b0e14;
}

.account-btn-primary:hover {
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}

.account-btn-secondary {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.account-btn-secondary:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: #38bdf8;
    transform: translateY(-1px);
}

.profile-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.account-btn-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    border: 1px solid #ef4444 !important;
}

.account-btn-danger:hover {
    background: rgba(239, 68, 68, 0.3) !important;
}

.oauth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 16px 0;
    color: #64748b;
    font-size: 12px;
}
.oauth-divider::before,
.oauth-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.oauth-divider span {
    padding: 0 10px;
}
.account-btn-oauth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    margin-top: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm, 8px);
    transition: all 0.2s ease;
    cursor: pointer;
}
.account-btn-oauth:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.account-btn-oauth img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.account-logged-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-md, 12px);
}

.account-avatar-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(129, 140, 248, 0.25));
    border: 2px solid #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.account-user-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.account-badge-online {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #4ade80;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.account-user-details h3 {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    word-break: break-all;
}

.account-user-sub {
    font-size: 12px;
    color: #94a3b8;
}

.account-actions-center {
    display: flex;
    justify-content: center;
}

.account-feedback {
    padding: 10px 14px;
    border-radius: var(--radius-sm, 8px);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.account-feedback.info {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.account-feedback.success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.account-feedback.error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ==== 4. Pestaña de Mi Perfil ==== */
.account-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.45);
    border-radius: var(--radius-sm, 8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.account-profile-alias-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.account-profile-alias-label {
    color: #94a3b8;
}

.account-profile-alias-value {
    color: #38bdf8;
    font-weight: 700;
    font-size: 16px;
}

.account-session-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.account-session-badge.synced {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.account-session-badge.guest {
    background: rgba(234, 179, 8, 0.18);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.35);
}

/* ==== 5. Tablas de Clasificación Global (Leaderboards) ==== */
.leaderboard-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leaderboard-header-row h3 {
    font-family: 'Cinzel', serif;
    font-size: 15px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.5px;
}

.account-refresh-btn {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.account-refresh-btn:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: #38bdf8;
}

.account-leaderboard-loading {
    padding: 12px;
    text-align: center;
    color: #38bdf8;
    font-size: 13px;
    font-style: italic;
}

.account-leaderboards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .account-leaderboards-container {
        grid-template-columns: 1fr;
    }
}

.leaderboard-column {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md, 12px);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-col-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    text-align: center;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard-table-wrap {
    overflow-x: auto;
}

.global-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.global-leaderboard-table th {
    text-align: left;
    padding: 6px 8px;
    color: #94a3b8;
    font-weight: 600;
    font-size: 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.global-leaderboard-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.col-rank {
    width: 44px;
    font-weight: 700;
    color: #cbd5e1;
}

.col-alias {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: #f1f5f9;
}

.col-metric {
    text-align: right;
    font-weight: 700;
    color: #38bdf8;
}

.rank-gold td {
    color: #fbbf24;
}
.rank-gold .col-rank {
    color: #facc15;
}

.rank-silver td {
    color: #e2e8f0;
}
.rank-silver .col-rank {
    color: #cbd5e1;
}

.rank-bronze td {
    color: #fdba74;
}
.rank-bronze .col-rank {
    color: #fb923c;
}

.empty-cell {
    text-align: center;
    color: #64748b;
    padding: 20px 8px !important;
    font-style: italic;
}

.account-modal-footer {
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 12px;
}

.account-modal-hint {
    font-size: 11px;
    color: #64748b;
}

/* ==== 6. Botón de Cuenta en el HUD ==== */
.hud-item-account {
    background: rgba(129, 140, 248, 0.14);
    border: 1px solid rgba(129, 140, 248, 0.35);
}

.hud-item-account .hud-btn-icon {
    color: #a5b4fc;
}

.hud-item-account:hover .hud-btn-icon {
    color: #ffffff;
}

/* ==== Tema Alquímico para SweetAlert2 ==== */
.swal2-popup {
    background: #0f172a !important; /* Fondo oscuro alquímico */
    color: #f8fafc !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.15) !important;
}

.swal2-title {
    color: #f8fafc !important;
    font-family: 'Cinzel', serif !important;
    font-weight: 800 !important;
}

.swal2-html-container {
    color: #94a3b8 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, #38bdf8, #818cf8) !important;
    color: #0b0e14 !important;
    font-weight: 800 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 24px !important;
    transition: transform 0.2s ease !important;
}

.swal2-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.4) !important;
}

.swal2-cancel {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
}

.swal2-input, .swal2-select {
    background: rgba(0, 0, 0, 0.3) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    border-radius: 8px !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.swal2-input:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2) !important;
}

/* Spinner de carga para botones de autenticación */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


