/* Global Base Styles */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0 !important;
    padding: 0 !important;
}

body {
    margin: 0 !important;
    padding: 0 !important;
    padding-top: 0 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Container Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.grid {
    display: grid;
}

/* Button Utilities */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

/* Header */
.site-header {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.75rem 0;
    margin: 0;
    box-shadow: var(--shadow-sm);
}

main {
    margin-top: 60px !important;
}

nav,
main,
header,
footer {
    margin: 0;
    padding: 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}

.nav-right-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s var(--ease-out);
}

.nav-link:hover {
    color: var(--primary);
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    color: var(--text-main);
    font-size: 0.9rem;
}

.theme-toggle:hover {
    background: var(--primary-subtle);
    color: var(--primary);
    border-color: var(--primary);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    color: var(--text-main);
    font-size: 1.1rem;
}


/* Footer */
footer {
    background: var(--footer-bg);
    color: var(--text-light);
    padding: 4rem 2rem 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.footer-section p {
    color: var(--text-muted);
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 0.8rem;
}

.footer-section ul li a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section ul li a:hover {
    color: var(--primary);
}

.copyright {
    text-align: center;
    color: var(--text-muted);
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* QR Code Styles */
.qr-container {
    display: flex;
    gap: 0.5rem;
}

.qr-box {
    text-align: center;
}

.qr-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background: #fff;
    border: 1px solid #dee2e6;
}

.qr-placeholder {
    width: 100px;
    height: 100px;
    background: #f1f3f5;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    border: 1px solid #dee2e6;
}

.qr-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.qr-label i {
    margin-right: 4px;
}

/* KF Widget Styles */
.kf-widget-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 320px;
    background: var(--bg-white);
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    z-index: 2000;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border);
}

.kf-widget-container.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.kf-header {
    background: var(--primary);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kf-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.close-kf {
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    opacity: 0.8;
}

.close-kf:hover {
    opacity: 1;
}

.kf-body {
    padding: 1.5rem;
    text-align: center;
}

.kf-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.kf-qr-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.kf-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.kf-qr-box {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-light);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.kf-qr-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kf-placeholder {
    font-size: 1.5rem;
    color: #cbd5e1;
}

.kf-item span {
    font-size: 0.8rem;
    color: var(--text-dark);
}

.kf-footer-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Floating Tools */
.floating-tools {
    position: fixed;
    right: 20px;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 990;
}

.tool-btn {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 1.1rem;
    border: none;
}

.tool-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    background: var(--primary-dark);
}

.tool-btn.kf-btn {
    background: var(--success);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tool-btn.kf-btn:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    background: #059669;
}

#backToTop {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

#backToTop.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        width: 100%;
        background: var(--bg-card);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        box-sizing: border-box;
    }

    .nav-links.active {
        display: flex;
    }

    [data-theme="dark"] .nav-links {
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .nav-right-controls {
        margin-left: auto;
        /* Push to right */
    }

    .floating-tools {
        right: 20px;
        bottom: 20px;
    }

    .qr-container {
        flex-direction: column;
        align-items: center;
    }

    /* Mobile Footer Optimization */
    .footer-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem 1rem;
        /* Center text for all sections */
        text-align: center;
    }

    /* Title section: Full width & Center */
    .footer-section:nth-child(1) {
        grid-column: 1 / -1;
        margin-bottom: 1.5rem;
    }

    .footer-section:nth-child(1) p {
        max-width: 300px;
        margin: 0 auto;
        font-size: 0.9rem;
        opacity: 0.8;
    }

    /* Products and Support sections */
    .footer-section:nth-child(2),
    .footer-section:nth-child(3) {
        text-align: center;
    }

    /* Center align list links */
    .footer-section ul li a {
        justify-content: center;
        padding: 0.25rem 0;
    }

    .footer-section h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
        position: relative;
        display: inline-block;
    }

    /* Optional: Add a small underline for aesthetics */
    .footer-section h3::after {
        content: '';
        position: absolute;
        bottom: -5px;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 2px;
        background: var(--primary);
        opacity: 0.5;
        border-radius: 2px;
    }

    /* Contact section: Hide on mobile */
    .footer-section:nth-child(4) {
        display: none;
    }
}