/* ==========================================
   MARRALHINHA SPA - MENU STYLES
   Menu com Tabs para Jogo Local/Online
   ========================================== */

.menu-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: var(--bg-primary);
    background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 2px, transparent 2px, transparent 16px);
}

.menu-title {
    width: 100%;
    font-size: 3em;
    margin: 0;
    text-shadow: 4px 4px 10px rgba(0,0,0,0.5);
    text-align: center;
}

.menu-subtitle {
    width: 100%;
    color: var(--text-secondary);
    margin: 5px 0 30px 0;
    text-align: center;
    font-size: 1.1em;
}

/* ==========================================
   LAYOUT DO MENU - Bloco único com Tabs
   ========================================== */
.menu-content {
    width: 100%;
    max-width: 500px;
}

.menu-box {
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.4);
    overflow: hidden;
}

/* ==========================================
   SISTEMA DE TABS
   ========================================== */
.menu-tabs {
    display: flex;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.menu-tab {
    flex: 1;
    padding: 18px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.05em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.menu-tab:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
}

.menu-tab.active {
    color: var(--accent-yellow);
    border-bottom-color: var(--accent-yellow);
    background: rgba(241, 196, 15, 0.1);
}

.menu-tab .tab-icon {
    font-size: 1.2em;
}

.menu-tab-content {
    display: none;
    padding: 30px;
}

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

/* ==========================================
   CONTEÚDO DAS TABS
   ========================================== */
.tab-section {
    text-align: center;
}

.section-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.section-title .icon {
    font-size: 1.2em;
}

.section-desc {
    color: var(--text-secondary);
    margin: 0 0 25px 0;
    font-size: 0.95em;
    line-height: 1.5;
}

/* ==========================================
   SERVIDOR OFFLINE
   ========================================== */
.server-offline-box {
    text-align: center;
    padding: 25px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.offline-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 15px;
}

.offline-text {
    color: var(--accent-red);
    font-weight: bold;
    margin: 0 0 10px 0;
}

.offline-hint {
    color: var(--text-muted);
    font-size: 0.9em;
    margin: 0 0 15px 0;
}

/* ==========================================
   UTILIZADOR LOGADO
   ========================================== */
.user-info-box {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
    margin-bottom: 20px;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    text-align: left;
}

.user-name {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--accent-yellow);
    margin-bottom: 5px;
}

.user-stats {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.logged-in-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.secondary-actions {
    display: flex;
    gap: 10px;
}

.secondary-actions .btn {
    flex: 1;
}

/* ==========================================
   FORMULÁRIO DE AUTH
   ========================================== */
.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 5px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: var(--text-secondary);
}

.auth-tab.active {
    background: var(--accent-blue);
    color: white;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1em;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    margin: 6px 0 0 0;
    font-size: 0.8em;
    color: var(--text-muted);
}

.form-error {
    margin: 6px 0 0 0;
    font-size: 0.85em;
    color: var(--accent-red);
    display: none;
}

.form-error.visible {
    display: block;
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1em;
    cursor: pointer;
    padding: 5px;
}

.password-toggle:hover {
    color: var(--text-secondary);
}

.forgot-password-link {
    text-align: center;
    margin-top: 15px;
}

.forgot-password-link a {
    color: var(--text-muted);
    font-size: 0.9em;
    text-decoration: none;
}

.forgot-password-link a:hover {
    color: var(--accent-yellow);
}

.info-box {
    background: rgba(52, 152, 219, 0.15);
    border: 1px solid rgba(52, 152, 219, 0.3);
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 20px;
    font-size: 0.85em;
    color: var(--text-secondary);
    text-align: left;
}

.info-box .icon {
    margin-right: 8px;
}

/* Alert Messages */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
    display: none;
    text-align: left;
}

.alert.visible {
    display: block;
}

.alert.error {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.alert.success {
    background: rgba(39, 174, 96, 0.2);
    border: 1px solid rgba(39, 174, 96, 0.3);
    color: #27ae60;
}

.alert.warning {
    background: rgba(241, 196, 15, 0.2);
    border: 1px solid rgba(241, 196, 15, 0.3);
    color: #f1c40f;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ==========================================
   BOTÕES
   ========================================== */
.btn-lg {
    padding: 16px 24px;
    font-size: 1.1em;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
}

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

.btn-purple:hover {
    background: #8e44ad;
}

/* ==========================================
   SUB-TABS LOBBY / GUEST (dentro de Jogo Online)
   ========================================== */
.online-subtabs {
    display: flex;
    margin-bottom: 22px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 5px;
    gap: 4px;
}

.online-subtab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    border-radius: 9px;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.online-subtab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
}

.online-subtab.active[data-subtab="lobby"] {
    background: var(--accent-blue);
    color: white;
}

.online-subtab.active[data-subtab="guest"] {
    background: #7d3c98;
    color: white;
}

.online-subtab-content {
    display: none;
}

.online-subtab-content.active {
    display: block;
}

/* Conteúdo da sub-tab Guest */
.guest-content {
    background: rgba(125, 60, 152, 0.08);
    border: 1px solid rgba(125, 60, 152, 0.2);
    border-radius: 14px;
    padding: 24px 20px;
}

/* ==========================================
   SECÇÃO DE CONVIDADO (legado — mantido para compatibilidade)
   ========================================== */
.guest-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0 20px;
    color: var(--text-muted);
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.guest-divider::before,
.guest-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.guest-divider span {
    flex-shrink: 0;
}

.guest-section {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 20px;
}

.guest-section-title {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin: 0 0 16px;
    letter-spacing: 0.03em;
}

.guest-disclaimer {
    text-align: center;
    font-size: 0.78em;
    color: var(--text-muted);
    margin: 10px 0 0;
    opacity: 0.75;
}

.btn-guest {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
    display: inline-block;
    text-align: center;
}

.btn-guest:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(46, 204, 113, 0.3);
}

.btn-guest:active {
    transform: translateY(0);
}

/* ==========================================
   RESPONSIVE - Mobile
   ========================================== */
@media (max-width: 768px) {
    /* Permitir scroll quando o conteúdo ultrapassa a altura do ecrã */
    .menu-container {
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: 24px;
        padding-bottom: 30px;
    }

    .menu-content {
        max-width: 100%;
    }

    .menu-title {
        font-size: 2.2em;
    }

    .menu-tab {
        padding: 15px 10px;
        font-size: 0.95em;
    }

    .menu-tab-content {
        padding: 25px 20px;
    }

    .guest-section {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .menu-container {
        padding: 15px;
        padding-top: 20px;
        padding-bottom: 30px;
    }

    .menu-title {
        font-size: 1.8em;
    }

    .menu-tab {
        padding: 12px 8px;
        font-size: 0.85em;
        flex-direction: column;
        gap: 5px;
    }

    .menu-tab .tab-icon {
        font-size: 1.5em;
    }

    .menu-tab-content {
        padding: 18px 14px;
    }

    .user-info-box {
        flex-direction: column;
        text-align: center;
    }

    .user-details {
        text-align: center;
    }

    .secondary-actions {
        flex-direction: column;
    }

    .guest-divider {
        margin: 20px 0 16px;
    }

    .guest-section {
        padding: 14px;
        border-radius: 12px;
    }

    .guest-section-title {
        font-size: 0.85em;
        margin-bottom: 12px;
    }

    .guest-disclaimer {
        font-size: 0.75em;
    }
}

/* ==========================================
   MODAL DE RECUPERAÇÃO DE PASSWORD
   ========================================== */
#forgot-password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: modalFadeIn 0.2s ease;
    padding: 20px;
}

#forgot-password-modal.closing {
    animation: modalFadeOut 0.2s ease forwards;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

#forgot-password-modal .modal-container {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#forgot-password-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#forgot-password-modal .modal-header h2 {
    margin: 0;
    font-size: 1.3em;
    color: var(--text-primary);
}

#forgot-password-modal .modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#forgot-password-modal .modal-close:hover {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

#forgot-password-modal .modal-body {
    padding: 25px;
}

#forgot-password-modal .modal-description {
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    font-size: 0.95em;
    line-height: 1.5;
}

#forgot-password-modal .modal-hint {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 15px;
    text-align: center;
}

#forgot-password-modal .modal-hint a {
    color: var(--accent-blue);
    text-decoration: none;
}

#forgot-password-modal .modal-hint a:hover {
    text-decoration: underline;
}

#forgot-password-modal .modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

#forgot-password-modal .modal-footer .btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 1em;
}

/* Input especial para código */
#forgot-password-modal .reset-code-input {
    text-align: center;
    font-size: 1.8em !important;
    letter-spacing: 10px;
    font-weight: bold;
    padding: 20px !important;
}

#forgot-password-modal .reset-code-input::placeholder {
    letter-spacing: 10px;
    opacity: 0.3;
}

/* Responsive modal */
@media (max-width: 480px) {
    #forgot-password-modal {
        padding: 15px;
        align-items: flex-start;
        padding-top: 50px;
    }
    
    #forgot-password-modal .modal-container {
        max-width: 100%;
    }
    
    #forgot-password-modal .modal-header {
        padding: 15px 20px;
    }
    
    #forgot-password-modal .modal-header h2 {
        font-size: 1.1em;
    }
    
    #forgot-password-modal .modal-body {
        padding: 20px;
    }
    
    #forgot-password-modal .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    #forgot-password-modal .reset-code-input {
        font-size: 1.5em !important;
        letter-spacing: 8px;
    }
}
