/* ==========================================
   HERMYON PWA — Onboarding Screens
   HomeGarden.bio Design System
   ==========================================
   Z-index hierarchy:
   - .screen (onboarding/success): 9999
   - .loading-overlay: 10000
*/

.screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #1a3a2f 0%, #0d2b21 40%, #0a2018 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: screenFadeIn 0.4s ease-out;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Subtle botanical pattern overlay */
.screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 184, 148, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 210, 160, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(111, 207, 151, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

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

.onboarding-container,
.success-container {
    position: relative;
    background: transparent;
    padding: 32px 32px 48px;
    max-width: 380px;
    width: 90%;
    text-align: center;
}

.logo-large {
    margin-bottom: 4px;
    display: flex;
    justify-content: center;
    animation: logoAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.onboarding-logo-img {
    width: 140px;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.2));
}

@keyframes logoAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.onboarding-container h1 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Subtle accent line between heading and subtitle */
.onboarding-container h1::after {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #00b894, #00d2a0);
    margin: 12px auto 0;
    border-radius: 2px;
}

.subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 28px;
    letter-spacing: 0.02em;
}

.id-input-container {
    margin-bottom: 20px;
}

/* ---- Scan Hint Section ---- */
.onboarding-scan-hint {
    margin-bottom: 4px;
}

.scan-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    text-align: left;
}

.scan-option-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-option-icon svg {
    stroke: rgba(255, 255, 255, 0.9);
}

.scan-option-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.scan-option-text strong {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
}

.scan-option-text span {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

.scan-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
}

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

.scan-divider span {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.id-input-container label {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    text-align: left;
}

.device-id-input {
    width: 100%;
    padding: 14px 16px;
    font-family: 'DM Sans', monospace;
    font-size: 1.0625rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transition: all 0.2s ease;
}

.device-id-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.15);
}

.device-id-input:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.device-id-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 2px;
}

.help-text {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 8px;
    text-align: left;
}

.primary-button {
    width: 100%;
    padding: 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    background: #ffffff;
    color: #1a3a2f;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.primary-button:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.primary-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.primary-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.primary-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.error-message {
    background: rgba(231, 76, 60, 0.2);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8125rem;
    margin-top: 16px;
    border: 1px solid rgba(231, 76, 60, 0.3);
    animation: errorShake 0.4s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.support-link-container {
    margin-top: 24px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.4);
}

.support-link-container a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.support-link-container a:hover {
    color: #ffffff;
}

.support-link-container a:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* ---- Onboarding Install Button ---- */
.onboarding-install-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 24px;
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 50px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.onboarding-install-button:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.onboarding-install-button:active {
    transform: scale(0.96);
}

@media (max-width: 768px) {
    .onboarding-install-button {
        font-size: 0.8125rem;
        padding: 10px 20px;
        margin-top: 16px;
    }
}

/* ---- Success Screen ---- */
.success-icon {
    margin-bottom: 20px;
    animation: successPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes successPop {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-container h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
}

.success-container p {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 24px;
}

.success-container strong {
    color: #ffffff;
    font-family: 'DM Sans', monospace;
    font-weight: 600;
}

/* Loading overlay styles are defined in styles.css
   No duplicate needed here — the main styles.css version
   provides the correct light-theme loading overlay. */

/* ---- Mobile Optimized ---- */
@media (max-width: 768px) {
    .onboarding-container,
    .success-container {
        max-width: 100%;
        width: 100%;
        padding: 12px 24px 24px;
    }

    .onboarding-logo-img {
        width: 80px;
    }

    .logo-large {
        margin-bottom: -4px;
    }

    .onboarding-container h1 {
        font-size: 1.375rem;
        margin-bottom: 4px;
    }

    .onboarding-container h1::after {
        margin: 6px auto 0;
        width: 28px;
        height: 1.5px;
    }

    .subtitle {
        font-size: 0.8125rem;
        margin-bottom: 16px;
    }

    .scan-option {
        padding: 12px;
        gap: 10px;
        border-radius: 10px;
    }

    .scan-option-icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .scan-option-icon svg {
        width: 20px;
        height: 20px;
    }

    .scan-option-text strong {
        font-size: 0.8125rem;
    }

    .scan-option-text span {
        font-size: 0.75rem;
    }

    .scan-divider {
        margin: 12px 0 10px;
    }

    .scan-divider span {
        font-size: 0.6875rem;
    }

    .id-input-container label {
        font-size: 0.8125rem;
    }

    .device-id-input {
        padding: 12px 14px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .help-text {
        font-size: 0.6875rem;
        margin-top: 4px;
    }

    .primary-button {
        padding: 13px;
        font-size: 0.9375rem;
        border-radius: 10px;
    }

    .id-input-container {
        margin-bottom: 12px;
    }

    .error-message {
        font-size: 0.8125rem;
        padding: 10px 12px;
    }

    .support-link-container {
        margin-top: 14px;
        font-size: 0.75rem;
    }

    /* Success Screen */
    .success-container h2 {
        font-size: 1.375rem;
    }

    .success-container p {
        font-size: 0.875rem;
    }
}

/* ---- Accessibility ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
