/* ============================================================
   Z-INDEX HIERARCHY - CRITICAL FIX
   ============================================================ */
:root {
    --z-base: 1;
    --z-header: 1000;
    --z-dropdown: 1001;
    --z-mobile-menu: 1002;
    --z-modal: 10000;
    --z-cookie-consent: 9999;
    --z-preloader: 100;
}

/* --- CSS VARIABLES  --- */
:root {
    /* LIGHT MODE */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-footer: #ffffff;
    --bg-input: #f1f5f9;
    --bg-hover: #f8fafc;
    --bg-progress-track: #e2e8f0;
    
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --primary: #0e582d;
    --primary-hover: #08331a;
    --primary-soft: #eff6ff;
    --primary-text: #ffffff;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --success: #22c55e;
    --success-soft: #f0fdf4;
    
    --radius: 12px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-btn: 0 2px 4px rgba(0,0,0,0.05);
}

/* DARK MODE */
html.dark {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-header: #1e1e1e;
    --bg-footer: #1e1e1e;
    --bg-input: #2d2d2d;
    --bg-hover: #333333;
    --bg-progress-track: #333333;
    
    --border-color: #333333;
    --border-hover: #444444;
    
    --primary: #e5e5e5;
    --primary-hover: #ffffff;
    --primary-soft: rgba(255, 255, 255, 0.1);
    --primary-text: #121212;
    
    --text-main: #e5e5e5;
    --text-muted: #a3a3a3;
    --text-light: #737373;
    
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.15);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.15);
    
    --shadow-card: none;
    --shadow-btn: none;
}

/* --- RESET & BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* --- HEADER & NAVIGATION --- */
header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: var(--z-header); /* FIXED: Using CSS variable */
    transition: background-color 0.3s, border-color 0.3s;
}

.header-content {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.3s;
}

.logo i {
    color: var(--primary);
    transition: color 0.3s;
}

html.dark .logo i {
    color: #ffffff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Desktop Nav */
.nav-desktop {
    display: flex;
    gap: 25px;
    align-items: center;
    margin-right: 15px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link:hover {
    color: var(--primary);
}

/* Dropdown menu */
.nav-dropdown {
    position: relative;
    height: 70px;
    display: flex;
    align-items: center;
}

.nav-dropdown .nav-link {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 25px;
    min-width: 280px;
    display: none;
    z-index: var(--z-dropdown); /* FIXED: Using CSS variable */
    transition: background-color 0.3s, border-color 0.3s;
}

html.dark .dropdown-menu {
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-category-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 700;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: 0.2s;
}

.dropdown-link:hover {
    color: var(--primary);
    transform: translateX(3px);
}

.dropdown-link i {
    width: 14px;
    height: 14px;
}

/* Icon Buttons */
.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-input);
}

.icon-btn i {
    width: 20px;
    height: 20px;
}

.hamburger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-main);
}

/* --- MOBILE MENU --- */
.mobile-menu {
    display: none;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    overflow: hidden;
    position: relative; /* FIXED: Added position */
    z-index: var(--z-mobile-menu); /* FIXED: Using CSS variable */
    transition: background-color 0.3s, border-color 0.3s;
}

.mobile-menu.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-link {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    display: block;
    width: 100%;
    text-align: left;
    transition: background-color 0.2s, color 0.2s;
}

.mobile-link:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

/* Mobile Category (Accordion) */
.mobile-category {
    border-bottom: 1px solid var(--border-color);
}

.mobile-category-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--text-main);
    font-size: 1rem;
    background: var(--bg-card);
    transition: background-color 0.2s, color 0.2s;
}

.mobile-category-header:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.mobile-category-header i {
    transition: transform 0.3s;
}

.mobile-category-content {
    display: none;
    background: var(--bg-input);
    padding: 15px 20px;
}

.mobile-category.active .mobile-category-content {
    display: block;
}

.mobile-category.active .mobile-category-header i {
    transform: rotate(180deg);
}

.mobile-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.mobile-sublink:hover {
    color: var(--primary);
}



/* --- PAGE HEADER --- */
.page-header {
    text-align: center;
    padding: 40px 0 20px;
}

.page-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 10px;
    transition: color 0.3s;
}

.page-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    transition: color 0.3s;
}

/* --- BUTTONS --- */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-text);
    box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--text-muted);
}

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

/* --- FOOTER --- */
footer {
    background: var(--bg-footer);
    border-top: 1px solid var(--border-color);
    padding: 70px 0 30px;
    margin-top: auto;
    transition: background-color 0.3s, border-color 0.3s;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 50px;
}

.footer-widget h4 {
    color: var(--text-main);
    margin-bottom: 20px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    transition: color 0.3s;
}

.footer-widget h4 i {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 5px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 10px;
    transition: color 0.3s;
}

.footer-bottom {
    text-align: center;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    font-size: 0.85rem;
    transition: color 0.3s, border-color 0.3s;
}

/* --- ICON SIZES --- */
.icon-sm { width: 18px; height: 18px; }
.icon-md { width: 24px; height: 24px; }
.icon-xs { width: 16px; height: 16px; }
.icon-xxs { width: 12px; height: 12px; }

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* --- UTILITY CLASSES --- */
.text-primary-dynamic {
    color: var(--primary);
    transition: color 0.3s;
}

.text-muted-p {
    color: var(--text-muted);
    transition: color 0.3s;
}

/* --- RESPONSIVE --- */
@media (min-width: 1025px) {
    /* CRITICAL FIX: Force hide mobile elements on desktop */
    .mobile-menu {
        display: none !important;
    }
    .hamburger {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .nav-desktop {
        display: none;
    }
    .hamburger {
        display: flex;
    }
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .page-title {
        font-size: 1.8rem;
    }
}


/* --- SEO SECTION --- */
.seo-section {
    padding: 50px 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
    transition: background-color 0.3s, border-color 0.3s;
}

.seo-section.hidden {
    display: none !important;
}

.seo-container {
    max-width: 900px;
    margin: 0 auto;
}

.seo-block {
    margin-bottom: 40px;
}

.seo-block h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 15px;
    transition: color 0.3s;
}

.seo-block p,
.seo-block li {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 10px;
    transition: color 0.3s;
}

.seo-block ul,
.seo-block ol {
    padding-left: 20px;
    color: var(--text-muted);
}

/* --- ACCORDION FAQ --- */
.accordion-item {
    border-bottom: 1px solid var(--border-color);
}

.accordion-header {
    padding: 18px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-main);
    font-size: 1rem;
    transition: color 0.3s;
}

.accordion-header i {
    transition: transform 0.3s;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content p {
    padding-bottom: 18px;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    transition: color 0.3s;
}

.accordion-item.active .accordion-content {
    max-height: 200px;
}

.accordion-item.active .accordion-header i {
    transform: rotate(180deg);
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .action-footer {
        flex-direction: column;
        gap: 15px;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    .settings-bar {
        flex-direction: column;
        align-items: stretch;
    }
}
.accordion-header {
    display: flex;
    align-items: center;
    width: 100%;
}

.accordion-icon-left {
    margin-right: 12px;
    flex-shrink: 0;
}

.accordion-text {
    flex: 1;
    text-align: left;
    margin-right: 12px;
}

.accordion-icon-right {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.accordion-item.active .accordion-icon-right {
    transform: rotate(180deg);
}

/* ============================================================
   MODAL COMPARISON - CRITICAL Z-INDEX FIX
   ============================================================ */
.modal-comparison,
.comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: var(--z-modal); /* FIXED: Using CSS variable for proper stacking */
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-comparison.active,
.comparison-modal.active {
    display: flex;
}

.modal-comparison .modal-content,
.comparison-modal .modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    z-index: calc(var(--z-modal) + 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s, border-color 0.3s;
}

html.dark .modal-comparison .modal-content,
html.dark .comparison-modal .modal-content {
    background: #1e1e1e;
    border: 1px solid #333;
}

.modal-comparison .modal-header,
.comparison-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.modal-comparison .modal-header h3,
.comparison-modal .modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.modal-close,
.modal-close-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 24px;
    line-height: 1;
}

.modal-close:hover,
.modal-close-btn:hover {
    background: var(--bg-input);
    border-color: var(--danger);
    color: var(--danger);
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.comparison-item {
    text-align: center;
}

.comparison-item h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 15px;
}

.comparison-img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.comparison-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 10px;
}

@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

.term-contact-policy-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 70px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
#tool-host {
    display: block;
    width: 100%;
    min-height: 300px;
    margin: 2rem 0;
}

#vm-hw {
    display: block;
    width: 100%;
}

#tool-area {
    display: block;
    width: 100%;
}