/* PWA login — WhatsApp-style */

:root {
    --pwa-green: #008069;
    --pwa-green-light: #00a884;
    --pwa-bg: #111b21;
    --pwa-panel: #ffffff;
    --pwa-text: #111b21;
    --pwa-muted: #667781;
    --pwa-border: #e9edef;
    --pwa-safe-top: env(safe-area-inset-top, 0px);
    --pwa-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    min-height: 100dvh;
}

.pwa-login-page {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--pwa-bg);
    color: #fff;
}

.pwa-login-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(2rem + var(--pwa-safe-top)) 1.5rem 2rem;
    text-align: center;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0, 168, 132, 0.25) 0%, transparent 60%),
        var(--pwa-bg);
}

.pwa-login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    border-radius: 1.25rem;
    background: linear-gradient(145deg, var(--pwa-green-light), var(--pwa-green));
    box-shadow: 0 12px 40px rgba(0, 168, 132, 0.35);
}

.pwa-login-logo svg {
    width: 2.75rem;
    height: 2.75rem;
    color: #fff;
}

.pwa-login-hero h1 {
    margin: 1.25rem 0 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.pwa-login-hero p {
    margin: 0.5rem 0 0;
    max-width: 18rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #8696a0;
}

.pwa-login-card {
    background: var(--pwa-panel);
    color: var(--pwa-text);
    border-radius: 1.25rem 1.25rem 0 0;
    padding: 1.5rem 1.25rem calc(1.5rem + var(--pwa-safe-bottom));
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
}

.pwa-login-card label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--pwa-muted);
}

.pwa-login-input {
    display: block;
    width: 100%;
    margin-top: 0.375rem;
    min-height: 3rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--pwa-border);
    border-radius: 0.75rem;
    font-size: 16px;
    color: var(--pwa-text);
    background: #f0f2f5;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pwa-login-input:focus {
    border-color: var(--pwa-green-light);
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.15);
    background: #fff;
}

.pwa-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3rem;
    margin-top: 0.5rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pwa-green-light), var(--pwa-green));
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 168, 132, 0.35);
}

.pwa-login-btn:active {
    transform: scale(0.98);
}

.pwa-login-hint {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--pwa-muted);
}

.pwa-login-error {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #fce8e6;
    color: #b3261e;
    font-size: 0.875rem;
    line-height: 1.45;
}

html.pwa-is-installed .js-pwa-install-btn,
html.pwa-is-installed .pwa-install-action,
html.pwa-is-installed #pwa-chat-install,
html.pwa-is-installed #pwa-install-banner,
html.pwa-is-installed .js-pwa-install-nav {
    display: none !important;
}

.pwa-install-banner {
    display: none;
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: #e7fce3;
    color: #008069;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.pwa-install-banner.is-visible {
    display: block;
}

.pwa-install-banner-text {
    margin: 0 0 0.75rem;
}

.pwa-install-action,
.pwa-install-banner .pwa-install-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(145deg, var(--pwa-green-light), var(--pwa-green));
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
}

.pwa-install-action.is-visible,
.pwa-install-action:not([hidden]) {
    display: inline-flex;
}

.pwa-chat-install {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: #e7fce3;
    border-bottom: 1px solid #cfe9d8;
    color: #008069;
    font-size: 0.75rem;
    line-height: 1.35;
}

.pwa-chat-install.is-visible,
.pwa-chat-install:not([hidden]) {
    display: flex;
}

.pwa-chat-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-chat-install .pwa-install-action {
    width: auto;
    min-height: 2rem;
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.pwa-offline-page {
    display: flex;
    min-height: 100dvh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    background: #d1d7db;
    color: #111b21;
}

.pwa-offline-page svg {
    width: 4rem;
    height: 4rem;
    color: #667781;
}

.pwa-offline-page h1 {
    margin: 1rem 0 0;
    font-size: 1.25rem;
}

.pwa-offline-page p {
    margin: 0.5rem 0 0;
    color: #667781;
    line-height: 1.5;
}

.pwa-offline-page .pwa-login-btn {
    width: auto;
    padding: 0 2rem;
    margin-top: 1.5rem;
    text-decoration: none;
}

.pwa-standalone-only { display: none; }
.pwa-browser-only { display: inline-flex; }

@media (display-mode: standalone) {
    .pwa-standalone-only { display: inline-flex; }
    .pwa-browser-only { display: none !important; }
}

.pwa-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: #54656f;
    cursor: pointer;
    border-radius: 999px;
}

.pwa-logout-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}
