/* ═══════════════════════════════════════════════════════════════
   SF Auth — Estilos compartidos de autenticación StudioFutbol
   Incluir en cualquier página que use sf_auth.js
   ═══════════════════════════════════════════════════════════════ */

/* ── Botón "Cuenta Studiofutbol" (no autenticado) ────────────── */
.sf-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #6fa053;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.2px;
    text-decoration: none;
}
.sf-login-btn:hover  { filter: brightness(1.1); transform: translateY(-1px); }
.sf-login-btn:active { transform: scale(0.95); }

/* ── Widget de usuario autenticado ───────────────────────────── */
.sf-user-widget {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 4px 10px 4px 4px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: background 0.2s;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    user-select: none;
}
.sf-user-widget:hover { background: rgba(255, 255, 255, 0.09); }

/* Avatar circular */
.sf-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.2);
}
.sf-avatar-initials {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #6fa053;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.sf-user-name {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sf-widget-chevron {
    opacity: 0.6;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.sf-user-widget.open .sf-widget-chevron { transform: rotate(180deg); }

/* ── Dropdown ────────────────────────────────────────────────── */
.sf-user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 210px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 9999;
    overflow: hidden;
    border: 1px solid #e9ecef;
    animation: sfDropIn 0.18s cubic-bezier(.4,0,.2,1);
}
.sf-user-dropdown.open { display: block; }

@keyframes sfDropIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.sf-dropdown-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sf-dropdown-header strong {
    font-size: 0.88rem;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sf-dropdown-header span {
    font-size: 0.73rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sf-dropdown-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 50px;
    margin-top: 4px;
    background: rgba(111,160,83,0.12);
    color: #6fa053;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    width: fit-content;
}

.sf-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 11px 16px;
    border: none;
    background: none;
    color: #374151;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.12s;
    text-decoration: none;
}
.sf-dropdown-item:hover  { background: #f9fafb; }
.sf-dropdown-item:active { background: #f3f4f6; }
.sf-dropdown-item svg    { flex-shrink: 0; color: #9ca3af; }
.sf-dropdown-item.danger       { color: #dc2626; }
.sf-dropdown-item.danger svg   { color: #dc2626; }
.sf-dropdown-item.danger:hover { background: #fff5f5; }

.sf-dropdown-divider {
    height: 1px;
    background: #f0f2f5;
    margin: 4px 0;
}

.sf-dropdown-badge--admin {
    background: rgba(239,68,68,0.12);
    color: #dc2626;
}

/* ══════════════════════════════════════════════════════════════════
   SF Auth Modal — "Una cuenta. Todo StudioFutbol."
   ══════════════════════════════════════════════════════════════════ */

/* Overlay */
.sf-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: background 0.22s ease, backdrop-filter 0.22s ease;
    pointer-events: none;
}
.sf-modal-overlay.sf-modal-open {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: auto;
}
.sf-modal-overlay.sf-modal-closing {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    pointer-events: none;
}

/* Box */
.sf-modal-box {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 36px 32px 28px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.10);
    transform: scale(0.94) translateY(12px);
    opacity: 0;
    transition: transform 0.24s cubic-bezier(.4,0,.2,1), opacity 0.22s ease;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.sf-modal-open .sf-modal-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.sf-modal-closing .sf-modal-box {
    transform: scale(0.94) translateY(12px);
    opacity: 0;
}

/* Close button */
.sf-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.sf-modal-close:hover { background: #e5e7eb; color: #374151; }

/* Logo */
.sf-modal-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}
.sf-modal-logo {
    height: 32px;
    width: auto;
    display: block;
    /* Logo negro — visible en light, invertido en dark */
    filter: none;
}

/* Headline */
.sf-modal-headline {
    font-size: 1.55rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.2;
    letter-spacing: -0.3px;
}
.sf-modal-headline--accent {
    color: #6fa053;
    margin-bottom: 10px;
}

/* Sub-headline */
.sf-modal-sub {
    font-size: 0.88rem;
    color: #6b7280;
    line-height: 1.55;
    margin: 0 0 22px;
}

/* Features list */
.sf-modal-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
    text-align: left;
}
.sf-modal-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f9fafb;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}
.sf-modal-feature-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1;
}

/* Google button */
.sf-modal-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    border: 1.5px solid #dadce0;
    border-radius: 50px;
    background: #fff;
    color: #3c4043;
    font-size: 0.93rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    letter-spacing: 0.1px;
}
.sf-modal-google-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.sf-modal-google-btn:active {
    background: #f1f3f4;
}
.sf-modal-google-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Legal */
.sf-modal-legal {
    font-size: 0.73rem;
    color: #9ca3af;
    margin: 12px 0 0;
    line-height: 1.5;
}
.sf-modal-legal a {
    color: #6fa053;
    text-decoration: none;
}
.sf-modal-legal a:hover { text-decoration: underline; }

/* ── Success state (post-login) ─────────────────────────────── */
.sf-modal-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.sf-modal-success-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #6fa053, #5a8a40);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.6rem;
    animation: sfSuccessPop 0.35s cubic-bezier(.4,0,.2,1);
}
@keyframes sfSuccessPop {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.1); }
    100% { transform: scale(1);   opacity: 1; }
}
.sf-modal-success-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #111827;
    margin: 0;
}
.sf-modal-success-sub {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
}

/* ── Dark-mode adaptation ────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    .sf-modal-box {
        background: #1a2030;
        box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    }
    .sf-modal-close {
        background: rgba(255,255,255,0.08);
        color: #9ca3af;
    }
    .sf-modal-close:hover { background: rgba(255,255,255,0.14); color: #e5e7eb; }
    .sf-modal-headline { color: #f9fafb; }
    .sf-modal-sub { color: #9ca3af; }
    .sf-modal-feature { background: rgba(255,255,255,0.06); color: #d1d5db; }
    .sf-modal-google-btn {
        background: #fff;
        border-color: #dadce0;
        color: #3c4043;
    }
    .sf-modal-google-btn:hover { background: #f8f9fa; }
    .sf-modal-legal { color: #6b7280; }
    .sf-modal-success-title { color: #f9fafb; }
    .sf-modal-logo {
        /* Logo negro — invertir para que sea blanco en dark */
        filter: invert(1) brightness(2);
    }
}

/* Manual dark-mode class (cuando la app usa .dark-mode en body) */
body.dark-mode .sf-modal-box {
    background: #1a2030;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
body.dark-mode .sf-modal-close {
    background: rgba(255,255,255,0.08);
    color: #9ca3af;
}
body.dark-mode .sf-modal-close:hover { background: rgba(255,255,255,0.14); color: #e5e7eb; }
body.dark-mode .sf-modal-headline { color: #f9fafb; }
body.dark-mode .sf-modal-headline--accent { color: #7ab85e; }
body.dark-mode .sf-modal-sub { color: #9ca3af; }
body.dark-mode .sf-modal-feature { background: rgba(255,255,255,0.06); color: #d1d5db; }
body.dark-mode .sf-modal-google-btn { background: #fff; border-color: #dadce0; color: #3c4043; }
body.dark-mode .sf-modal-legal { color: #6b7280; }
body.dark-mode .sf-modal-success-title { color: #f9fafb; }
body.dark-mode .sf-modal-logo { filter: invert(1) brightness(2); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .sf-modal-box {
        padding: 28px 20px 22px;
        border-radius: 16px;
    }
    .sf-modal-headline { font-size: 1.35rem; }
}
