/* QR Code Generator - Custom Styles */

:root {
    --qrcode-shell-max-width: 56rem;
    --qrcode-safe-top: env(safe-area-inset-top, 0px);
    --qrcode-header-height: 72px;
    --qrcode-main-top-gap: 32px;
    --qrcode-nav-side-padding: 0px;
    --qrcode-nav-padding-y: 16px;
}

/* Base font improvements */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.qrcode-page-body {
    margin: 0;
    padding: 0 18px;
    background:
        radial-gradient(circle at top right, rgba(255, 107, 157, 0.08), transparent 28%),
        linear-gradient(180deg, #fff7fa 0%, #f8fafc 22%, #f3f4f6 100%);
}

.qrcode-main {
    padding-top: calc(var(--qrcode-header-height) + var(--qrcode-main-top-gap));
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: calc(var(--qrcode-nav-padding-y) + var(--qrcode-safe-top)) 0 var(--qrcode-nav-padding-y);
    transition: all 0.3s ease;
    background: #fff;
    border-bottom: 1px solid rgba(26, 26, 94, 0.08);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.nav-logo img {
    height: 40px;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}

.nav-links .has-dropdown {
    position: relative;
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 6px 0;
    min-width: 160px;
    list-style: none;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.has-dropdown:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown li a {
    display: block;
    padding: 10px 20px;
    font-size: 14px;
    color: #1a1a5e;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-dropdown li a:hover {
    background: #fff0f5;
    color: #ff6b9d;
}

.nav-links a,
.lihi-site-footer-links a,
.lihi-site-footer-social a {
    color: #1a1a5e;
    transition: color 0.2s ease;
}

.nav-links a {
    font-size: 15px;
    font-weight: 500;
}

.nav-links a:hover,
.lihi-site-footer-links a:hover,
.lihi-site-footer-social a:hover {
    color: #ff6b9d;
}

.nav-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.nav-cta.mobile {
    gap: 8px;
    margin-left: auto;
    margin-right: 8px;
}

.nav-cta.mobile .lihi-btn-primary {
    padding: 8px 16px;
    font-size: 14px;
    box-shadow: none;
}

.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    border: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
    z-index: 2;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: #1a1a5e;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

.nav-hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-mobile-overlay {
    display: none;
    position: fixed;
    top: var(--qrcode-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.nav-mobile-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.nav-mobile-menu {
    display: none;
    position: fixed;
    top: var(--qrcode-header-height);
    left: 0;
    right: 0;
    background: #fff;
    padding: 24px;
    max-height: calc(100vh - var(--qrcode-header-height));
    overflow-y: auto;
    box-shadow: none;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.nav-mobile-menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.mobile-only {
    display: none !important;
}

.nav-mobile-menu a,
.mobile-submenu-toggle {
    display: block;
    padding: 12px 0;
    font-size: 16px;
    color: #1a1a5e;
    border-bottom: 1px solid #eee;
}

.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 16px;
}

.mobile-submenu.open {
    max-height: 200px;
}

.mobile-submenu a {
    font-size: 15px;
    color: #6b7280;
}

.nav-mobile-menu .mobile-cta-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.nav-mobile-menu .mobile-cta-row a {
    border-bottom: none;
    padding: 14px;
    font-size: 16px;
    text-align: center;
    flex: 1;
}

.nav-mobile-menu .mobile-cta-row .lihi-btn-secondary {
    color: #ff6b9d;
    border: 2px solid #ff6b9d;
}

body.menu-open {
    overflow: hidden;
}

.lihi-btn-primary,
.lihi-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 18px;
    transition: all 0.2s ease;
}

.lihi-btn-primary {
    background: #ff6b9d;
    color: #fff;
    box-shadow: 0 10px 24px rgba(255, 107, 157, 0.22);
}

.lihi-btn-primary:hover {
    background: #f2558c;
    color: #fff;
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 12px 28px rgba(255, 107, 157, 0.32);
}

.lihi-btn-secondary {
    background: transparent;
    border: 2px solid #ff6b9d;
    color: #ff6b9d;
    font-weight: 600;
}

.lihi-btn-secondary:hover {
    background: #ff6b9d;
    color: #fff;
}

.qrcode-hero-copy {
    text-align: center;
    margin-bottom: 28px;
}

.qrcode-hero-title {
    margin: 0;
    color: #1a1a5e;
    font-size: clamp(1.7rem, 2.8vw, 2.35rem);
    line-height: 1.15;
    font-weight: 800;
}

.qrcode-hero-subtitle {
    margin: 10px 0 0;
    color: #6b7280;
    font-size: 0.98rem;
}

.lihi-site-footer {
    max-width: var(--qrcode-shell-max-width);
    margin: 0 auto;
    padding: 28px 0 40px;
    border-top: 1px solid rgba(26, 26, 94, 0.08);
}

.lihi-site-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 28px;
    color: #6b7280;
}

.lihi-site-footer-left p {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.55;
}

.lihi-site-footer-logo {
    width: 120px;
    height: auto;
    margin-bottom: 14px;
}

.lihi-site-footer-right {
    text-align: right;
}

.lihi-site-footer-links,
.lihi-site-footer-social {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.lihi-site-footer-links {
    margin-bottom: 12px;
}

.lihi-site-footer-links a {
    font-size: 13px;
}

.qrcode-seo-section {
    max-width: var(--qrcode-shell-max-width);
    margin: 0 auto;
    padding: 4px 0 28px;
}

.qrcode-seo-shell {
    padding: 30px 32px;
    border: 1px solid rgba(26, 26, 94, 0.07);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 248, 251, 0.92) 100%);
    box-shadow: 0 14px 28px rgba(26, 26, 94, 0.04);
}

.qrcode-seo-header h2,
.qrcode-seo-block h3 {
    margin: 0;
    color: #1a1a5e;
    line-height: 1.2;
}

.qrcode-seo-header h2 {
    font-size: 1.65rem;
    font-weight: 800;
}

.qrcode-seo-kicker {
    margin: 0 0 10px;
    color: #c45c91;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.qrcode-seo-header p,
.qrcode-seo-block p {
    color: #5f6788;
    line-height: 1.78;
}

.qrcode-seo-header > p:last-child {
    margin: 12px 0 0;
    font-size: 1rem;
}

.qrcode-seo-body {
    margin-top: 24px;
    border-top: 1px solid rgba(26, 26, 94, 0.08);
    padding-top: 8px;
}

.qrcode-seo-block {
    padding: 18px 0;
}

.qrcode-seo-block + .qrcode-seo-block {
    border-top: 1px solid rgba(26, 26, 94, 0.08);
}

.qrcode-seo-block h3 {
    font-size: 1.08rem;
    line-height: 1.2;
    font-weight: 800;
}

.qrcode-seo-block p {
    margin: 10px 0 0;
    font-size: 0.98rem;
}

.faq-section {
    max-width: var(--qrcode-shell-max-width);
    margin: 0 auto;
    padding: 8px 0 28px;
}

.faq-section::before {
    content: '';
    display: block;
    height: 1px;
    margin: 0 auto 30px;
    background: linear-gradient(90deg, rgba(26, 26, 94, 0), rgba(26, 26, 94, 0.12) 18%, rgba(255, 107, 157, 0.28) 50%, rgba(26, 26, 94, 0.12) 82%, rgba(26, 26, 94, 0));
}

.faq-shell {
    padding: 30px 30px 34px;
    border: 1px solid #ead8e3;
    border-radius: 28px;
    background: linear-gradient(180deg, #fffefe, #fff7fb 58%, #fffefe);
    box-shadow: 0 18px 34px rgba(26, 26, 94, 0.05);
}

.faq-header {
    text-align: center;
    margin-bottom: 20px;
}

.faq-header h2 {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    color: #51608f;
}

.faq-header p {
    margin-top: 8px;
    font-size: 15px;
    color: #8790b5;
}

.faq-list {
    display: grid;
    gap: 12px;
}

.faq-item {
    border: 1px solid rgba(18, 20, 95, 0.1);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 10px 24px rgba(18, 20, 95, 0.05);
    overflow: hidden;
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 500;
    color: #55618d;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(236, 28, 148, 0.08);
    color: #c4689b;
    font: 700 22px/1 'Inter', sans-serif;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.faq-item[open] summary::after {
    content: '-';
    transform: rotate(180deg);
    background: rgba(236, 28, 148, 0.14);
    color: #b34f86;
}

.faq-answer {
    padding: 0 24px 22px;
    text-align: left;
    font-size: 16px;
    line-height: 1.7;
    color: #6b7399;
}

.faq-answer a {
    color: #b34f86;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.faq-answer a:hover {
    color: #c31778;
}

.faq-cta-wrap {
    display: flex;
    justify-content: center;
    padding-top: 22px;
}

.faq-cta-button {
    min-width: 156px;
}

/* Header container constraint */
header {
    background-color: #ffffff;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

header > div {
    max-width: var(--qrcode-shell-max-width);
    margin-left: auto;
    margin-right: auto;
}

/* Modal animation */
@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-modal-in {
    animation: modal-in 0.2s ease-out;
}

/* Toast notification */
#toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* File input label hover */
label:has(input[type="file"]):hover {
    border-color: #020266;
    background-color: rgba(2, 2, 102, 0.05);
}

/* Tab transitions */
.qr-type-tab {
    transition: all 0.2s ease;
}

.tab-content {
    transition: opacity 0.2s ease;
}

/* Focus states for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #020266;
    outline-offset: 2px;
}

/* Prevent text selection on buttons */
button {
    user-select: none;
}

/* Smooth transitions for cards */
.bg-white {
    transition: box-shadow 0.2s ease;
}

/* Step indicator styling */
#step1, #step2 {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#step1.hidden, #step2.hidden {
    display: none;
}

/* QR Preview container */
#qrPreviewContainer {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* QR Code styling */
#qrCodePreview {
    display: flex;
    align-items: center;
    justify-content: center;
}

#qrCodePreview svg,
#qrCodePreview canvas,
#qrCodePreview img {
    max-width: 100%;
    height: auto;
}

/* Modal QR Preview */
#modalQrPreview {
    width: 240px;
    height: 240px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modalQrPreview svg {
    width: 240px !important;
    height: 240px !important;
}

/* QR with background wrapper - CSS scales it */
.qr-with-bg {
    border-radius: 12px;
    overflow: hidden;
    width: 260px;
    height: 260px;
    flex-shrink: 0;
}

.qr-with-bg svg {
    display: block;
    width: 260px;
    height: 260px;
}

/* Upload label styling */
label:has(input[type="file"]) {
    cursor: pointer;
    transition: all 0.2s ease;
}

label:has(input[type="file"]):hover {
    border-color: #020266 !important;
    background-color: rgba(2, 2, 102, 0.02);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Gradient background for preview */
#previewArea {
    background: linear-gradient(135deg, #f0f4ff 0%, #fce7f3 50%, #fef3c7 100%);
    transition: background 0.3s ease;
}

/* Button hover effects */
button:not(:disabled):hover {
    transform: translateY(-1px);
}

button:not(:disabled):active {
    transform: translateY(0);
}

/* Modal backdrop */
#modalBackdrop {
    backdrop-filter: blur(4px);
}

/* Input placeholder styling */
input::placeholder,
textarea::placeholder {
    color: #9ca3af;
}

/* Select dropdown arrow */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Password toggle button */
#toggleWifiPassword {
    transition: color 0.2s ease;
}

/* Error state for required fields */
.input-error {
    border-color: #ef4444 !important;
    border-width: 1px !important;
    box-shadow: none !important;
}

.input-error:focus {
    border-color: #ef4444 !important;
    ring: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Clear buttons */
#clearBgBtn,
#clearLogoBtn {
    transition: all 0.2s ease;
}

#clearBgBtn:hover,
#clearLogoBtn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 0.5rem;
}

/* Download buttons */
#downloadPngBtn,
#downloadSvgBtn {
    transition: all 0.2s ease;
}

/* ==================== MOBILE RESPONSIVE ==================== */

/* Mobile */
@media (max-width: 640px) {
    :root {
        --qrcode-main-top-gap: 28px;
        --qrcode-nav-side-padding: max(14px, env(safe-area-inset-right, 0px));
    }

    .qrcode-page-body {
        padding: 0 12px;
    }

    .nav-inner {
        padding-left: max(14px, env(safe-area-inset-left, 0px));
        padding-right: max(18px, env(safe-area-inset-right, 0px));
    }

    .nav-hamburger {
        padding: 10px;
        margin-right: -2px;
    }

    .desktop-only,
    .nav-links,
    .nav-cta.desktop {
        display: none !important;
    }

    .mobile-only.nav-hamburger {
        display: flex !important;
    }

    .mobile-only.nav-cta.mobile {
        display: flex !important;
    }

    .mobile-only.nav-mobile-menu,
    .mobile-only.nav-mobile-overlay {
        display: block !important;
    }

    body.menu-open .desktop-only {
        display: none !important;
    }

    .lihi-site-footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .lihi-site-mobile-cta-row .lihi-btn-primary,
    .lihi-site-mobile-cta-row .lihi-btn-secondary {
        flex: 1;
        padding-left: 12px;
        padding-right: 12px;
    }

    .lihi-site-footer-right {
        text-align: left;
    }

    .lihi-site-footer-links,
    .lihi-site-footer-social {
        justify-content: flex-start;
    }

    .qrcode-hero-copy {
        margin-bottom: 22px;
    }

    .qrcode-seo-shell {
        padding: 22px 18px 24px;
        border-radius: 22px;
    }

    .qrcode-seo-header h2 {
        font-size: 1.35rem;
    }

    .qrcode-seo-kicker {
        font-size: 0.74rem;
        letter-spacing: 0.1em;
    }

    .qrcode-seo-body {
        margin-top: 20px;
    }

    .qrcode-seo-block {
        padding: 16px 0;
    }

    .qrcode-seo-block h3 {
        font-size: 1rem;
    }

    .faq-section {
        padding-bottom: 22px;
    }

    .faq-section::before {
        margin-bottom: 22px;
    }

    .faq-shell {
        padding: 22px 18px 24px;
        border-radius: 22px;
    }

    .faq-item summary {
        padding: 16px 18px;
        font-size: 16px;
        gap: 12px;
    }

    .faq-answer {
        padding: 0 18px 18px;
        font-size: 15px;
    }

    .faq-cta-wrap {
        padding-top: 18px;
    }

    /* Tab buttons */
    .qr-type-tab {
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Upload label text */
    #bgFileName,
    #logoFileName {
        font-size: 0.75rem;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* QR Preview - slightly smaller on mobile but still larger than before */
    .qr-with-bg {
        width: 240px;
        height: 240px;
    }
    
    .qr-with-bg svg {
        width: 240px;
        height: 240px;
    }
    
    /* Modal QR Preview */
    #modalQrPreview {
        width: 220px;
        height: 220px;
    }
    
    #modalQrPreview svg {
        width: 220px !important;
        height: 220px !important;
    }
    
    /* Modal adjustments */
    #downloadModal > div > div {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Download buttons in modal */
    #downloadModal .flex.gap-2 {
        flex-direction: column;
    }
    
    #downloadPngBtn,
    #downloadSvgBtn {
        width: 100%;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .qr-type-tab {
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
    }
    
    /* Smaller buttons */
    #nextStepBtn,
    #prevStepBtn,
    #generateBtn,
    #clearBtn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}
