/**
 * SKYJO Maus Edition - Login Screen Styles
 * v1.0 - Modern Auth UI with Google, Apple, Guest
 */

/* ========== LOGIN SCREEN CONTAINER ========== */
/* v27.0 FIX: Removed display:flex - this was overriding .skyjo-screen display:none
   and causing the login screen to always be visible even when not active!
   The .skyjo-screen.active rule handles display:flex */
#screen-login {
    /* display is controlled by .skyjo-screen and .skyjo-screen.active */
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
    background: inherit;
}

/* When active, use flex layout */
#screen-login.active {
    display: flex;
}

/* Ensure login content is above ::before overlay */
#screen-login .login {
    position: relative;
    z-index: 1;
}

/* ========== LOGIN CARD ========== */
.login {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Logo / Branding */
.login__logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.login__logo-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    animation: loginLogoFloat 3s ease-in-out infinite;
}

@keyframes loginLogoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login__title {
    font-family: var(--font-display, 'Fredoka', sans-serif);
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    margin: 0;
}

.login__subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* ========== AUTH BUTTONS CONTAINER ========== */
.login__buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* ========== AUTH BUTTON BASE ========== */
.login__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 54px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-body, 'Quicksand', sans-serif);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.login__btn:active {
    transform: scale(0.98);
}

.login__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login__btn-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.login__btn-text {
    flex: 1;
    text-align: center;
}

/* Loading Spinner */
.login__btn--loading .login__btn-text {
    opacity: 0;
}

.login__btn--loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: loginBtnSpin 0.8s linear infinite;
}

@keyframes loginBtnSpin {
    to { transform: rotate(360deg); }
}

/* ========== GOOGLE BUTTON ========== */
.login__btn--google {
    background: white;
    color: #3c4043;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.login__btn--google:hover:not(:disabled) {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.login__btn--google .login__btn-icon {
    /* Google G Logo Colors */
}

/* ========== GUEST BUTTON ========== */
.login__btn--guest {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login__btn--guest:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ========== EMAIL BUTTON ========== */
.login__btn--email {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

.login__btn--email:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a9fe8 0%, #4589cc 100%);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
}

/* ========== PHONE BUTTON ========== */
.login__btn--phone {
    background: linear-gradient(135deg, #25d366 0%, #1da851 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.login__btn--phone:hover:not(:disabled) {
    background: linear-gradient(135deg, #30e075 0%, #25bc5c 100%);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

/* ========== PRIMARY BUTTON (for forms) ========== */
.login__btn--primary {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

.login__btn--primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a9fe8 0%, #4589cc 100%);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
    transform: translateY(-1px);
}

/* ========== DIVIDER ========== */
.login__divider {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.login__divider::before,
.login__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

/* ========== RECOVERY LINK ========== */
.login__recovery {
    margin-top: 8px;
}

.login__recovery-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}

.login__recovery-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.login__recovery-link svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* ========== FOOTER INFO ========== */
.login__footer {
    margin-top: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    line-height: 1.5;
}

.login__footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: underline;
}

/* ========== ERROR MESSAGE ========== */
.login__error {
    display: none;
    width: 100%;
    padding: 12px 16px;
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 8px;
    color: #ff6b7a;
    font-size: 0.9rem;
    text-align: center;
}

.login__error.visible {
    display: block;
}

/* ========== LOGIN FORMS (Email/Phone) ========== */
.login__form {
    display: none;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.login__form.visible {
    display: flex !important;
}

.login__form-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0 0 8px 0;
    text-align: center;
}

.login__input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.login__input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.login__input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.login__input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Phone Input Row */
.login__phone-row {
    display: flex;
    gap: 8px;
}

.login__country-select {
    width: 90px;
    padding: 14px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
}

.login__country-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

.login__country-select option {
    background: #2a2a40;
    color: white;
}

.login__phone-input {
    flex: 1;
}

/* Code Input */
.login__code-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 8px;
    font-weight: 600;
}

/* Form Buttons */
.login__form-btn {
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login__form-btn--primary {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
}

.login__form-btn--primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a9fe8 0%, #4589cc 100%);
    transform: translateY(-1px);
}

.login__form-btn--secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login__form-btn--secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.login__form-btn--link {
    background: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 8px;
    font-size: 0.9rem;
}

.login__form-btn--link:hover {
    color: white;
}

.login__form-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Back Button in Forms */
.login__back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.login__back-btn:hover {
    color: white;
}

.login__back-btn svg {
    width: 16px;
    height: 16px;
}

/* Form Info Text */
.login__form-info {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    line-height: 1.4;
}

/* Form Divider */
.login__form-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.login__form-divider::before,
.login__form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

/* Form Links Container */
.login__form-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

/* Link Buttons */
.login__link {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.login__link:hover {
    color: white;
}

/* Phone Input Wrapper */
.login__phone-input-wrapper {
    display: flex;
    gap: 8px;
}

.login__phone-input-wrapper .login__country-select {
    flex-shrink: 0;
}

.login__phone-input-wrapper .login__input--phone {
    flex: 1;
}

/* Code Input styling */
.login__input--code {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 6px;
    font-weight: 600;
}

/* Form Subtitle */
.login__form-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin: 0 0 8px 0;
}

/* ========== PWA INSTALL GUIDE ========== */
.login__install-guide {
    margin-top: 16px;
    position: relative;
    z-index: 10;
}

/* Modal inside login screen - hidden by default */
.login__modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Show modal when visible */
.login__modal[style*="display: block"],
.login__modal[style*="display: flex"],
.login__modal.open {
    display: flex !important;
}

.login__modal .skyjo-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.login__install-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login__install-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.login__install-btn svg {
    width: 18px;
    height: 18px;
}

/* Install Guide Modal */
.install-guide {
    position: relative;
    z-index: 1;
    max-width: 400px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(145deg, #1a2a3a 0%, #0d1a28 100%) !important;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.install-guide__header {
    text-align: center;
    margin-bottom: 20px;
}

.install-guide__logo {
    width: 60px;
    height: 60px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.install-guide__title {
    font-family: var(--font-display, 'Fredoka', sans-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0 0 4px 0;
}

.install-guide__subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Device Tabs */
.install-guide__tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.install-guide__tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.install-guide__tab svg {
    width: 20px;
    height: 20px;
}

.install-guide__tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.install-guide__tab.active {
    background: rgba(245, 166, 35, 0.2);
    border-color: rgba(245, 166, 35, 0.5);
    color: var(--cheese, #f5a623);
}

/* Steps */
.install-guide__steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.install-guide__step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.install-guide__step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cheese, #f5a623) 0%, #e09520 100%);
    border-radius: 50%;
    color: #1a1a2e;
    font-weight: 700;
    font-size: 0.85rem;
}

.install-guide__step-content {
    flex: 1;
}

.install-guide__step-content p {
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

.install-guide__step-content strong {
    color: white;
}

.install-guide__icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.install-guide__icon-box svg {
    width: 24px;
    height: 24px;
    color: var(--cheese, #f5a623);
}

.install-guide__action-preview {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
}

.install-guide__action-preview svg {
    width: 20px;
    height: 20px;
    color: var(--cheese, #f5a623);
}

.install-guide__alt {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 6px !important;
}

.install-guide__hint {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    color: #81c784;
    font-size: 0.85rem;
}

/* Benefits */
.install-guide__benefits {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.install-guide__benefit {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.install-guide__benefit svg {
    width: 18px;
    height: 18px;
    color: #4caf50;
    flex-shrink: 0;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 400px) {
    .login {
        padding: 0 8px;
    }

    .login__logo-img {
        width: 80px;
        height: 80px;
    }

    .login__title {
        font-size: 1.75rem;
    }

    .login__btn {
        min-height: 50px;
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}

/* ========== LANDSCAPE MOBILE ========== */
@media (max-height: 500px) and (orientation: landscape) {
    #screen-login {
        padding: 12px;
    }

    .login {
        gap: 12px;
    }

    .login__logo {
        flex-direction: row;
        gap: 16px;
        margin-bottom: 4px;
    }

    .login__logo-img {
        width: 60px;
        height: 60px;
    }

    .login__title {
        font-size: 1.5rem;
    }

    .login__subtitle {
        display: none;
    }

    .login__buttons {
        gap: 8px;
    }

    .login__btn {
        min-height: 44px;
        padding: 10px 20px;
    }
}
