/* Shared WhatsApp-style auth shell (login, signup, verify, phone reset) */

* {
    box-sizing: border-box;
}

/* Auth pages: never inherit chat shell (dark body / overflow:hidden) */
html,
body.auth-page,
body:has(.whatsapp-login-container),
html:has(.whatsapp-login-container) {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 100% !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: #111b21 !important;
    background-color: #005c4b !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scroll-behavior: smooth;
}

.whatsapp-login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00a884 0%, #008069 50%, #005c4b 100%);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 40px 20px;
}

.background-circles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    animation: wa-auth-float 20s infinite ease-in-out;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 200px;
    height: 200px;
    bottom: -50px;
    right: -50px;
    animation-delay: 5s;
}

.circle-3 {
    width: 400px;
    height: 400px;
    top: 50%;
    right: -200px;
    animation-delay: 10s;
}

@keyframes wa-auth-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-50px) scale(1.1); }
}

.whatsapp-login-box {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: wa-auth-slide-up 0.6s ease-out;
}

@keyframes wa-auth-slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.whatsapp-logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.3);
    animation: wa-auth-pulse 2s infinite;
    overflow: hidden;
}

.whatsapp-logo-circle img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

@keyframes wa-auth-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.whatsapp-logo-circle i {
    font-size: 42px;
    color: white;
}

.app-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
    color: #111b21;
}

.logo-primary {
    color: #25D366;
}

.logo-secondary {
    color: #3E7BAD;
}

.app-subtitle {
    color: #667781;
    font-size: 15px;
    margin: 0;
    font-weight: 400;
}

.whatsapp-alert {
    margin-bottom: 24px;
    animation: wa-auth-slide-down 0.4s ease-out;
}

@keyframes wa-auth-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-content {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #155724;
    font-size: 14px;
}

.alert-content.alert-warning,
.alert-content.alert-error {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert-content.alert-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-content i {
    font-size: 18px;
}

.whatsapp-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.whatsapp-login-container .form-group {
    position: relative;
    margin: 0;
    margin-bottom: 0;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: #8696a0;
    font-size: 18px;
    z-index: 1;
    transition: color 0.3s;
    pointer-events: none;
}

.whatsapp-login-container .whatsapp-input,
.whatsapp-login-container input.whatsapp-input,
.whatsapp-login-container select.whatsapp-input {
    width: 100%;
    height: auto;
    padding: 16px 16px 16px 48px;
    border: 2px solid #e9edef;
    border-radius: 12px;
    font-size: 16px;
    line-height: 1.4;
    color: #111b21;
    transition: all 0.3s;
    background: #f0f2f5;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.whatsapp-login-container .whatsapp-input:focus,
.whatsapp-login-container input.whatsapp-input:focus,
.whatsapp-login-container select.whatsapp-input:focus {
    background: #fff;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
    outline: none;
}

.whatsapp-login-container .input-wrapper:focus-within .input-icon {
    color: #25D366;
}

.whatsapp-input::placeholder {
    color: #8696a0;
    opacity: 1;
}

.input-wrapper select.whatsapp-input {
    padding-right: 40px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238696a0' d='M1.4 0L6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.toggle-password {
    position: absolute;
    right: 12px;
    color: #8696a0;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s;
    z-index: 2;
    background: none;
    border: none;
    padding: 8px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover,
.toggle-password:focus {
    color: #25D366;
    outline: none;
}

.error-text {
    color: #ea4335;
    font-size: 13px;
    margin-top: 6px;
    display: block;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #721c24;
    font-size: 14px;
}

.error-message i {
    font-size: 18px;
}

.whatsapp-login-container .whatsapp-btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    width: 100%;
    text-decoration: none;
    line-height: 1.2;
}

.whatsapp-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.whatsapp-btn:hover::before {
    width: 300px;
    height: 300px;
}

.whatsapp-btn span,
.whatsapp-btn i {
    position: relative;
    z-index: 1;
}

.whatsapp-login-container .whatsapp-btn-primary {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.whatsapp-login-container .whatsapp-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
    transform: translateY(-2px);
    color: #fff;
    text-decoration: none;
}

.whatsapp-login-container .whatsapp-btn-primary:active {
    transform: translateY(0);
}

.whatsapp-login-container .whatsapp-btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none !important;
}

.whatsapp-login-container .whatsapp-btn-secondary {
    width: 100%;
    background: transparent;
    color: #00a884;
    border: 2px solid #00a884;
    box-shadow: none;
}

.whatsapp-login-container .whatsapp-btn-secondary:hover {
    background: rgba(0, 168, 132, 0.08);
    transform: translateY(-1px);
    color: #008069;
}

.whatsapp-login-container .whatsapp-btn-secondary:active {
    transform: translateY(0);
}

.whatsapp-login-container .whatsapp-btn-secondary::before {
    display: none;
}

.form-footer {
    text-align: center;
    margin-top: -8px;
}

.link-secondary {
    color: #00a884;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s;
}

.link-secondary:hover {
    color: #128C7E;
    text-decoration: underline;
}

.signup-link {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid #e9edef;
    color: #667781;
    font-size: 15px;
    margin-top: 8px;
}

.signup-link .link-primary {
    color: #00a884;
    text-decoration: none;
    font-weight: 600;
    margin-left: 6px;
    transition: color 0.3s;
}

.signup-link .link-primary:hover {
    color: #128C7E;
    text-decoration: underline;
}

.divider {
    margin: 20px 0;
    text-align: center;
    position: relative;
    display: block !important;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e9edef;
}

.divider span {
    background: #fff;
    padding: 0 16px;
    color: #667781;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.whatsapp-login-container .whatsapp-btn-passkey {
    background: linear-gradient(135deg, #667781 0%, #3E7BAD 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(62, 123, 173, 0.4);
    width: 100%;
    display: flex !important;
    margin-bottom: 0 !important;
}

.whatsapp-login-container .whatsapp-btn-passkey:hover {
    box-shadow: 0 6px 20px rgba(62, 123, 173, 0.5);
    transform: translateY(-2px);
    color: #fff;
}

.whatsapp-login-container .whatsapp-btn-passkey:active {
    transform: translateY(0);
}

.whatsapp-btn-passkey i {
    font-size: 20px;
}

@media (max-width: 768px) {
    html,
    body.auth-page,
    body:has(.whatsapp-login-container),
    html:has(.whatsapp-login-container) {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .whatsapp-login-container {
        padding: 20px 15px;
        min-height: 100vh;
        min-height: 100dvh;
        overflow-y: auto;
    }

    .whatsapp-login-box {
        padding: 32px 24px;
        border-radius: 20px;
        max-width: 100%;
        margin: auto;
    }

    .app-title {
        font-size: 28px;
    }

    .whatsapp-logo-circle {
        width: 70px;
        height: 70px;
    }

    .whatsapp-logo-circle i {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .whatsapp-login-container {
        padding: 15px 10px;
    }

    .whatsapp-login-box {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .app-title {
        font-size: 24px;
    }

    .whatsapp-logo-circle {
        width: 60px;
        height: 60px;
    }

    .whatsapp-login-container .whatsapp-input,
    .whatsapp-login-container input.whatsapp-input,
    .whatsapp-login-container select.whatsapp-input {
        font-size: 15px;
    }

    .whatsapp-login-container .whatsapp-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}
