/* QRP Welcome — Native Mobile Gateway Layout */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-200: #bfdbfe;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-dim: #64748b;
    --success: #10b981;
    --shadow-card: 0 12px 40px rgba(37, 99, 235, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.welcome-page {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text-main);
    background: #e0f2fe;
    /* Soft blue outer background for desktop framing */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Water Waves & Floating Leaves Background */
.wave-bg {
    position: absolute;
    left: 0;
    width: 100%;
    z-index: 1;
    pointer-events: none;
}

.wave-bg--top {
    top: 0;
    height: 140px;
}

.wave-bg--bottom {
    bottom: 0;
    height: 130px;
}

.wave-bg svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaves-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.leaf {
    position: absolute;
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
    opacity: 0.85;
}

.leaf--top-1 {
    top: 70px;
    left: 4%;
    transform: rotate(45deg);
    animation: floatLeaf1 6s ease-in-out infinite;
}

.leaf--top-2 {
    top: 120px;
    left: 12%;
    width: 20px;
    height: 20px;
    transform: rotate(15deg);
    animation: floatLeaf2 5s ease-in-out infinite;
}

.leaf--bottom-1 {
    bottom: 60px;
    left: 6%;
    width: 38px;
    height: 38px;
    transform: rotate(-30deg);
    animation: floatLeaf1 7s ease-in-out infinite;
}

.leaf--bottom-2 {
    bottom: 40px;
    right: 5%;
    width: 35px;
    height: 35px;
    transform: rotate(60deg);
    animation: floatLeaf2 6s ease-in-out infinite;
}

@keyframes floatLeaf1 {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-5px) rotate(8deg);
    }
}

@keyframes floatLeaf2 {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-3px) rotate(-6deg);
    }
}

/* Shell Wrapper (Simulating a Native Mobile App viewport) */
.welcome-shell {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 450px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #f0f9ff;
    /* Light sky blue background inside the app */
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.15);
    /* Premium container shadow */
    animation: welcomeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    padding: 24px 16px 16px;
    /* Outer frame margin so card rounded corners don't touch screen edges! */
}

@keyframes welcomeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Header Section */
.welcome-header {
    text-align: center;
    padding: 15px 10px 10px;
    position: relative;
    z-index: 2;
}

.company-title {
    font-size: 11px;
    font-weight: 800;
    color: #1e3a8a;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.location-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: 1.5px;
    margin-top: 2px;
    margin-bottom: 16px;
}

.location-title::before,
.location-title::after {
    content: "";
    height: 1.5px;
    width: 24px;
    background: linear-gradient(to right, transparent, #2563eb);
}

.location-title::after {
    background: linear-gradient(to left, transparent, #2563eb);
}

.logo-wrapper {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #ffffff;
    padding: 2px;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.12);
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(191, 219, 254, 0.4);
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.2;
}

.brand-name span {
    color: #2563eb;
}

.brand-tagline {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

/* Card Container (Styled as a floating native card sheet, rounded on all 4 corners!) */
.welcome-card {
    background: #ffffff;
    border-radius: 28px;
    /* Uniform rounded corners on all sides */
    padding: 28px 18px 24px;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.05);
    border: 1.5px solid rgba(191, 219, 254, 0.45);
    display: flex;
    flex-direction: column;
    z-index: 2;
    position: relative;
    margin-top: 8px;
    flex-grow: 1;
    /* Stretch cleanly to fill empty vertical space */
}

.card-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    margin-bottom: 0.2rem;
}

.card-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    text-align: center;
}

/* Water drop divider line */
.welcome-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 12px 0 16px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #2563eb, transparent);
    opacity: 0.6;
}

.drop-icon {
    color: #2563eb;
    animation: dropPulse 2s ease-in-out infinite;
}

@keyframes dropPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

/* Options horizontal single row list */
.welcome-options {
    display: flex;
    flex-direction: row;
    /* Horizontal alignment side-by-side! */
    gap: 8px;
    width: 100%;
}

.welcome-option {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px 4px 12px;
    border-radius: 20px;
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    background: #ffffff;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    z-index: 1;
    height: 126px;
    /* Optimized height for vertical stacking icons */
}

.welcome-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.05);
}

/* Native Click / Press Effect */
.welcome-option:active {
    transform: scale(0.97);
    background: #f8fafc;
}

/* Option watermark faint background SVG */
.option-watermark {
    position: absolute;
    right: -10px;
    bottom: -10px;
    height: 60px;
    width: auto;
    pointer-events: none;
    z-index: -1;
    opacity: 0.035;
    transition: all 0.3s ease;
}

.welcome-option:hover .option-watermark {
    opacity: 0.07;
    transform: scale(1.06) rotate(-2deg);
}

.welcome-option--admin {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, #ffffff 100%);
    border-color: rgba(37, 99, 235, 0.1);
}

.welcome-option--admin:hover {
    border-color: rgba(37, 99, 235, 0.25);
}

.welcome-option--admin .option-watermark {
    color: #2563eb;
}

.welcome-option--technician {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.03) 0%, #ffffff 100%);
    border-color: rgba(245, 158, 11, 0.1);
}

.welcome-option--technician:hover {
    border-color: rgba(245, 158, 11, 0.25);
}

.welcome-option--technician .option-watermark {
    color: #f59e0b;
}

.welcome-option--customer {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.02) 0%, #ffffff 100%);
    border-color: rgba(16, 185, 129, 0.08);
}

.welcome-option--customer:hover {
    border-color: rgba(16, 185, 129, 0.2);
}

.welcome-option--customer .option-watermark {
    color: #10b981;
}

/* List item icons (Centered top) */
.welcome-option-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    margin-bottom: 8px;
}

.welcome-option--admin .welcome-option-icon {
    background: linear-gradient(145deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.welcome-option--technician .welcome-option-icon {
    background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

.welcome-option--customer .welcome-option-icon {
    background: linear-gradient(145deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.18);
}

.welcome-option-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    z-index: 2;
}

.welcome-option-text strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.welcome-option-text span {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-top: 2px;
    line-height: 1.2;
}

/* Trust Grid inside card */
.trust-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    border-top: 1px dashed rgba(191, 219, 254, 0.4);
    margin-top: 1.5rem;
    padding-top: 1.25rem;
}

.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 2px;
    border-right: 1px solid rgba(226, 232, 240, 0.6);
}

.trust-item:last-child {
    border-right: none;
}

.trust-icon-wrapper {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.trust-icon {
    width: 18px;
    height: 18px;
}

.trust-item--safe .trust-icon {
    color: #2563eb;
}

.trust-item--pure .trust-icon {
    color: #0ea5e9;
}

.trust-item--support .trust-icon {
    color: #10b981;
}

.trust-item--trusted .trust-icon {
    color: #f59e0b;
}

.trust-title {
    font-size: 9.5px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.trust-subtitle {
    font-size: 8.5px;
    color: #64748b;
    line-height: 1.2;
    font-weight: 600;
}

/* Outside Help Section */
.welcome-help-section {
    text-align: center;
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

.help-title {
    font-size: 11px;
    color: #475569;
    font-weight: 600;
}

.help-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 800;
    color: #2563eb;
    text-decoration: none;
    transition: all 0.2s ease;
}

.help-phone:hover {
    color: #1d4ed8;
}

.help-phone-icon {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

.welcome-copyright {
    font-size: 9.5px;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

/* Mobile-First Tweaks */
@media (max-width: 520px) {
    body.welcome-page {
        background: #f0f9ff;
        /* Match the inside background */
    }

    .welcome-shell {
        box-shadow: none;
        /* Strip shadow on actual mobile device */
        padding: 16px 12px 12px;
        /* Snugger mobile framing */
    }

    .welcome-header {
        text-align: center;
        padding: 10px 5px;
        margin-bottom: 0.75rem;
    }

    .logo-wrapper {
        margin: 0 auto 6px;
        width: 64px;
        height: 64px;
    }

    .location-title {
        justify-content: center;
    }

    .location-title::before {
        display: block;
        content: "";
        height: 1.5px;
        width: 20px;
        background: linear-gradient(to right, transparent, #2563eb);
    }

    .location-title::after {
        width: 20px;
    }

    .welcome-card {
        padding: 22px 14px 20px;
        border-radius: 24px;
    }
}

@media (max-width: 400px) {
    .trust-title {
        font-size: 8.5px;
    }

    .trust-subtitle {
        font-size: 7.5px;
    }

    .trust-icon-wrapper {
        width: 24px;
        height: 24px;
        margin-bottom: 2px;
    }

    .trust-icon {
        width: 15px;
        height: 15px;
    }

    .trust-grid {
        gap: 2px;
    }

    .welcome-options {
        gap: 6px;
    }

    .welcome-option {
        height: 116px;
        padding: 12px 2px;
    }

    .welcome-option-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        margin-bottom: 6px;
    }

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

    .welcome-option-text strong {
        font-size: 0.72rem;
    }

    .welcome-option-text span {
        font-size: 0.6rem;
    }
}

/* PWA install banner on welcome page */
.welcome-page .pwa-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    padding: 14px 16px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    z-index: 10050;
    border: 1px solid #e2e8f0;
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease, visibility 0.35s ease;
    pointer-events: none;
}

.welcome-page .pwa-banner.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.welcome-page .pwa-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.welcome-page .pwa-icon img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.welcome-page .pwa-content {
    flex: 1;
}

.welcome-page .pwa-content h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.welcome-page .pwa-content p {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
}

.welcome-page .pwa-actions {
    display: flex;
    gap: 8px;
}

.welcome-page .pwa-btn {
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
}

.welcome-page .pwa-btn.primary {
    background: #2563eb;
    color: #fff;
}

.welcome-page .pwa-btn.secondary {
    background: #f1f5f9;
    color: #475569;
}

.welcome-page .pwa-install-hint {
    margin: 4px 0 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
}

/* PWA install guide sheet (welcome page has no styles.css) */
.pwa-guide-sheet {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pwa-guide-sheet.open {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.pwa-guide-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.pwa-guide-panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-guide-sheet.open .pwa-guide-panel {
    transform: translateY(0);
}

.pwa-guide-handle {
    width: 40px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 99px;
    margin: 4px auto 16px;
}

.pwa-guide-panel h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: #0f172a;
}

.pwa-guide-steps {
    margin: 0 0 12px 1.1rem;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #475569;
}

.pwa-guide-steps li {
    margin-bottom: 8px;
}

.pwa-guide-note {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0 0 16px;
    line-height: 1.45;
}

.pwa-guide-done {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

/* Water Technician Cartoon Graphic */
.welcome-technician-graphic {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.technician-img {
    width: 130px;
    height: auto;
    border-radius: 12px;
    mix-blend-mode: multiply;
    filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.08));
}