/* CSS Variables */
:root {
    --primary-color: #2a2a2a;
    --secondary-color: #ffffff;
    --accent-color: #046BD2;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --header-height: 60px;
    --card-bg-rgb: 42, 42, 42;
    --accent-color-rgb: 4, 107, 210;
    --primary-color-rgb: 42, 42, 42;
}

.dark-mode {
    --primary-color: #e0e0e0;
    --secondary-color: #2a2a2a;
    --bg-color: #1a1a1a;
    --card-bg: #2a2a2a;
    --card-bg-rgb: 42, 42, 42;
}

/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-color);
    line-height: 1.7;
    contain: layout;
}

body.menu-open {
    overflow: hidden;
}

/* Background overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    z-index: -1;
    border-radius: 0;
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.loader-circle {
    width: 50px;
    height: 50px;
    border: 4px solid var(--card-bg);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Header Styles */
header {
    background: linear-gradient(180deg, var(--card-bg), var(--bg-color));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 100;
    min-height: var(--header-height);
    padding: clamp(8px, 1.5vw, 12px) clamp(15px, 2vw, 20px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    text-decoration: none;
    display: block;
}

.logo h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.3rem, 2.5vw, 1.5rem);
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
    margin: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.5vw, 15px);
    z-index: 101;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--primary-color);
    font-size: clamp(0.85rem, 1.8vw, 0.95rem);
    font-weight: 500;
    padding: clamp(6px, 1vw, 8px) clamp(10px, 1.5vw, 12px);
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    background: rgba(var(--accent-color-rgb), 0.1);
    color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-link i {
    font-size: clamp(1rem, 1.8vw, 1.1rem);
}

.dropdown-chevron {
    margin-left: 6px;
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    transition: transform 0.3s ease;
}

.nav-item.with-dropdown:hover .dropdown-chevron {
    transform: rotate(180deg);
}

.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    min-width: clamp(180px, 20vw, 200px);
    z-index: 100;
    padding: 8px 0;
    transform: translateY(8px);
    opacity: 0;
    transition: all 0.3s ease;
}

.nav-item.with-dropdown:hover .sub-menu {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

.sub-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--primary-color);
    font-size: clamp(0.8rem, 1.7vw, 0.9rem);
    font-weight: 400;
    transition: all 0.3s ease;
}

.sub-link:hover {
    background: rgba(var(--accent-color-rgb), 0.15);
    color: var(--accent-color);
    padding-left: 20px;
}

/* Hamburger Menu */
.mobile-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 101;
}

.hamburger {
    width: 28px;
    height: 20px;
    position: relative;
}

.hamburger span {
    position: absolute;
    height: 2.5px;
    width: 100%;
    background: var(--accent-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 8px; }
.hamburger span:nth-child(3) { bottom: 0; }

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    padding: 8px;
    border-radius: 50%;
    width: clamp(28px, 4vw, 32px);
    height: clamp(28px, 4vw, 32px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Mobile Menu Overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* Main Content Styles */
main {
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s, transform 0.3s;
}

main.loading {
    opacity: 0;
    transform: translateY(20px);
}

/* Footer Styles */
footer {
    background-color: var(--card-bg);
    border-top: 3px solid var(--accent-color);
    padding: 4rem 2rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section {
    background: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.footer-section h3 {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
    display: inline-block;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--primary-color);
    text-decoration: none;
    position: relative;
}

.footer-section a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s;
}

.footer-section a:hover::after {
    width: 100%;
}

.social-icons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-icons a {
    width: 40px;
    height: 40px;
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.social-icons a:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--secondary-color);
    transform: translateY(-3px);
}

.contact-list li {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.contact-list li:hover {
    transform: translateX(5px);
    border-color: var(--accent-color);
}

.contact-list a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--primary-color);
}

.contact-list i {
    width: 20px;
    margin-right: 0.8rem;
    color: var(--accent-color);
}

.footer-section p {
    margin: 1rem 0;
    line-height: 1.6;
}

/* Status Popup */
.status-popup {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 25px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    text-align: center;
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 320px;
    width: auto;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    display: none;
    z-index: 999;
}

.status-popup.visible {
    bottom: 20px;
    opacity: 1;
}

.status-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: inline-block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.connected {
    color: #00c853;
    animation: bounceIn 0.8s;
}

.disconnected {
    color: #ff1744;
    animation: shake 0.6s;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    border-radius: 2px;
    overflow: hidden;
    display: none;
}

.progress {
    width: 0;
    height: 100%;
    background: #00c853;
    transition: width 3s linear;
}

@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(8px); }
    50% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
    100% { transform: translateX(0); }
}

.popup-content {
    position: relative;
    padding: 20px;
}

h3 {
    margin: 0 0 10px 0;
    font-size: 1.5em;
}

p {
    margin: 0;
    line-height: 1.5;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: #2d3436;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

/* Button Group */
.button-group {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    justify-content: center;
}

.btn-download {
    background: linear-gradient(135deg, #046BD2, #046BD2);
    box-shadow: 0 4px 15px rgba(4, 107, 210, 0.35);
}

.btn-reset {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.btn i {
    font-size: 1.3rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

/* Content Container */
.container {
    max-width: 1200px;
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(12px);
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    border: 1px solid;
}

.title {
    text-align: center;
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    position: relative;
    margin-top: 20px;
}

.title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px;
}

.read-more-btn {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: var(--secondary-color);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.5rem auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.read-more-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: all 0.5s ease;
}

.read-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.read-more-btn:hover::before {
    left: 100%;
}

.read-more-btn:active {
    transform: translateY(0);
}

.hidden-text {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease 0.2s;
    text-align: center;
    color: var(--primary-color);
    line-height: 1.8;
    padding: 0 2rem;
}

.hidden-text.active {
    max-height: none;
    opacity: 1;
    animation: textReveal 0.5s ease forwards;
}

@keyframes textReveal {
    0% { transform: translateY(10px); }
    100% { transform: translateY(0); }
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-item {
    padding: 1.5rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
}

.arrow {
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    width: 20px;
    height: 20px;
}

.read-more-btn.active .arrow {
    transform: rotate(180deg);
}

.highlight {
    position: relative;
    display: inline-block;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: rgba(139, 92, 246, 0.3);
    z-index: -1;
    transition: height 0.3s ease;
}

.hidden-text p {
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.hidden-text.active p {
    opacity: 1;
    transform: translateY(0);
}

.hidden-text p:nth-child(1) { transition-delay: 0.1s; }
.hidden-text p:nth-child(2) { transition-delay: 0.2s; }
.hidden-text p:nth-child(3) { transition-delay: 0.3s; }

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-container {
        padding: clamp(6px, 1.2vw, 10px) clamp(10px, 1.8vw, 15px);
        min-height: clamp(45px, 7vh, 50px);
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        background: rgba(var(--card-bg-rgb), 0.95);
        backdrop-filter: blur(12px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: clamp(20px, 3vw, 30px);
        z-index: 100;
        opacity: 0;
        transform: translateY(-100%);
        transition: opacity 0.4s ease, transform 0.4s ease;
        overflow-y: hidden;
    }

    .nav-links.active {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }

    .nav-item {
        width: 100%;
        max-width: 300px;
        margin: 8px 0;
    }

    .nav-link {
        justify-content: center;
        width: 100%;
        font-size: clamp(1rem, 2.2vw, 1.1rem);
        padding: clamp(10px, 2vw, 12px);
        background: rgba(var(--accent-color-rgb), 0.1);
        border-radius: 10px;
        border: 1px solid rgba(var(--accent-color-rgb), 0.2);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }

    .nav-link:hover {
        background: var(--accent-color);
        color: var(--secondary-color);
        transform: scale(1.05);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    }

    .nav-link i {
        font-size: clamp(1.1rem, 2vw, 1.2rem);
    }

    .sub-menu {
        position: static;
        width: 100%;
        background: rgba(var(--accent-color-rgb), 0.05);
        box-shadow: none;
        padding: 10px 15px;
        transform: none;
        opacity: 1;
        max-height: none;
        display: none;
        margin-top: 8px;
    }

    .nav-item.with-dropdown.active .sub-menu {
        display: block;
    }

    .sub-link {
        font-size: clamp(0.9rem, 1.9vw, 1rem);
        padding: clamp(8px, 1.5vw, 10px);
        background: rgba(var(--accent-color-rgb), 0.15);
        border-radius: 8px;
        justify-content: center;
    }

    .sub-link:hover {
        background: var(--accent-color);
        color: var(--secondary-color);
        transform: scale(1.03);
    }

    .mobile-menu {
        display: block;
        order: 1;
        margin-right: auto;
    }

    .close-menu {
        display: none;
        position: absolute;
        top: 20px;
        right: 20px;
        background: none;
        border: none;
        font-size: clamp(1.5rem, 3vw, 1.8rem);
        color: var(--primary-color);
        cursor: pointer;
        z-index: 102;
        padding: 8px;
        border-radius: 50%;
        transition: transform 0.3s ease;
    }

    .close-menu:hover {
        transform: rotate(90deg);
    }

    .nav-links.active .close-menu {
        display: block;
    }

    .logo {
        position: static;
        transform: none;
        order: 2;
        margin-left: 10px;
    }

    .theme-toggle {
        order: 3;
        margin-left: auto;
    }

    .nav-overlay.active {
        display: block;
    }
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: clamp(1.2rem, 2.2vw, 1.4rem);
    }

    .nav-link {
        font-size: clamp(0.95rem, 2vw, 1rem);
        padding: clamp(8px, 1.5vw, 10px);
    }

    .sub-link {
        font-size: clamp(0.85rem, 1.8vw, 0.95rem);
        padding: clamp(6px, 1.2vw, 8px);
    }

    .status-popup {
        width: 70%;
        max-width: none;
        padding: 20px 25px;
    }

    .status-icon {
        font-size: 48px;
    }

    h3 {
        font-size: 1.3em;
    }

    .theme-toggle {
        width: clamp(24px, 4vw, 28px);
        height: clamp(24px, 4vw, 28px);
        font-size: clamp(1rem, 2vw, 1.2rem);
    }

    .nav-container {
        min-height: clamp(40px, 6vh, 45px);
    }

    .footer-section {
        text-align: center;
    }

    .contact-list li {
        justify-content: center;
    }

    .social-icons {
        justify-content: center;
    }

    .footer-section h3 {
        display: block;
        text-align: center;
    }

    .title {
        font-size: 2rem;
    }

    .feature-list {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
        padding: 0.8rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: clamp(1.1rem, 2vw, 1.3rem);
    }

    .mobile-menu {
        padding: 6px;
    }

    .theme-toggle {
        padding: 6px;
        font-size: 1.3rem;
    }

    .nav-link {
        font-size: clamp(0.9rem, 1.8vw, 0.95rem);
        padding: clamp(6px, 1.2vw, 8px);
    }

    .close-menu {
        font-size: clamp(1.3rem, 2.8vw, 1.5rem);
    }
}