:root {
    --bg-dark: #020617; /* Very clean slate black */
    --accent-primary: #14b8a6; /* Teal for clean transparency */
    --accent-secondary: #06b6d4; /* Vibrant Cyan */
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.06);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

h1, h2, h3, h4, .logo, .hero-title {
    font-family: 'Outfit', sans-serif;
}

/* Background Blobs */
.blob-bg {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.4;
    animation: float 20s infinite alternate linear;
}
.blob-1 {
    top: -100px;
    left: -100px;
    width: 500px;
    height: 500px;
    background: var(--accent-primary);
}
.blob-2 {
    bottom: -200px;
    right: -100px;
    width: 600px;
    height: 600px;
    background: var(--accent-secondary);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.2); }
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}
.gradient-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}
.d-none { display: none !important; }
.mt-3 { margin-top: 1.5rem; }
.w-100 { width: 100%; }

/* Buttons */
.btn {
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #0284c7);
    color: white;
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.5);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}
.btn-lg {
    padding: 14px 32px;
    font-size: 1.1rem;
}

/* Navbar */
.navbar {
    padding: 1rem 0;
    position: sticky;
    top: 20px;
    z-index: 100;
    border-radius: 100px;
    margin: 20px;
}
.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
}
.nav-links {
    display: flex;
    gap: 30px;
}
.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    cursor: pointer;
    position: relative;
}
.nav-item:hover, .nav-item.active {
    color: white;
}
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px;
}

/* Language Switcher */
.lang-switcher {
    display: inline-flex;
    gap: 8px;
    color: var(--glass-border);
    font-size: 0.9rem;
    align-items: center;
    margin-right: 15px;
}
.lang-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}
.lang-btn:hover {
    color: white;
}
.lang-btn.active-lang {
    color: var(--accent-secondary);
}

/* Sections */
main {
    padding: 60px 0 100px;
}
.page-section {
    animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}
.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}
.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Hero */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    text-align: center;
}
.hero-content {
    max-width: 800px;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-secondary);
    padding: 8px 16px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 24px;
    border: 1px solid rgba(14, 165, 233, 0.2);
}
.hero-title {
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 24px;
    color: white;
}
.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}
.hero-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 60px;
}
.stats {
    display: flex;
    justify-content: space-around;
    padding: 30px;
}
.stat-item {
    text-align: center;
}
.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    font-family: 'Outfit', sans-serif;
}
.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

/* Marketplace Filters */
.filters {
    display: flex;
    gap: 20px;
    padding: 20px;
    margin-bottom: 40px;
}
.filter-group {
    flex: 1;
}
.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px;
    border-radius: 8px;
    outline: none;
    font-family: 'Inter', sans-serif;
}

/* Marketplace Grid */
.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}
.listing-card {
    overflow: hidden;
    transition: transform 0.3s;
}
.listing-card:hover {
    transform: translateY(-8px);
    border-color: rgba(20, 184, 166, 0.3);
}
.listing-img {
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 16px;
}
.listing-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}
.bg-primary { background: rgba(20, 184, 166, 0.8); backdrop-filter: blur(4px); }
.bg-secondary { background: rgba(14, 165, 233, 0.8); backdrop-filter: blur(4px); }

.listing-content {
    padding: 24px;
}
.listing-content h3 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}
.listing-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    height: 45px;
}
.metrics {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.metric {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #cbd5e1;
}
.metric i {
    color: var(--accent-secondary);
}
.listing-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}
.price-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.price-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

/* Progress bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
}

/* Escrow */
.escrow-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}
.escrow-steps {
    padding: 40px;
}
.step {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}
.step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.4);
}
.step-content h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}
.step-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
}
.pricing-card {
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}
.pricing-card ul {
    list-style: none;
    margin-top: 10px;
}
.pricing-card li {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #cbd5e1;
}

/* Escrow UI Visualization */
.escrow-visualization {
    padding: 40px;
    position: relative;
}
.escrow-ui {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.escrow-status {
    align-self: center;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 8px 16px;
    border-radius: 100px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}
.actor {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--glass-border);
}
.actor i {
    font-size: 2rem;
    color: var(--accent-secondary);
    background: rgba(14, 165, 233, 0.1);
    padding: 15px;
    border-radius: 50%;
}
.smart-contract {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(20, 184, 166, 0.05));
    border: 1px solid rgba(20, 184, 166, 0.3);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    position: relative;
}
.smart-contract i {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 10px;
}
.smart-contract::before, .smart-contract::after {
    content: '\f063'; /* Arrow down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    color: var(--glass-border);
    font-size: 1.5rem;
}
.smart-contract::before { top: -25px; left: 50%; transform: translateX(-50%); }
.smart-contract::after { bottom: -25px; left: 50%; transform: translateX(-50%); }

.amount-locked {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    margin-top: 10px;
}
.text-sm {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.close-modal {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 20px;
    transition: color 0.3s;
}

.close-modal:hover,
.close-modal:focus {
    color: white;
    text-decoration: none;
}

.modal-header {
    margin-bottom: 25px;
    padding-right: 20px;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 8px;
}

.modal-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

/* Custom Select CSS */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.select-selected {
    cursor: pointer;
    user-select: none;
    position: relative;
    display: flex;
    align-items: center;
}

.select-selected::after {
    position: absolute;
    content: "\f107";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.select-selected.select-arrow-active::after {
    transform: translateY(-50%) rotate(180deg);
}

.select-items {
    position: absolute;
    background-color: #1a1a2e; /* Dark theme to match */
    border: 1px solid var(--glass-border);
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 99;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    overflow: hidden;
}

.select-items div {
    color: white;
    padding: 12px 15px;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s, padding-left 0.3s;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
}

.select-items div:hover, .same-as-selected {
    background-color: rgba(20, 184, 166, 0.3); /* Transparent Teal */
    padding-left: 20px;
}

.select-hide {
    display: none;
}

.text-success {
    color: #10b981;
    font-size: 0.9rem;
}

/* =========================================
   Mobile Responsiveness
   ========================================= */
@media (max-width: 768px) {
    /* Navbar Adjustment */
    .nav-content {
        flex-wrap: wrap;
        gap: 5px;
        justify-content: space-between;
        align-items: center;
    }
    .navbar .btn-primary {
        display: none; /* Ховаємо велику кнопку в хедері для економії місця на мобільному */
    }
    .nav-links {
        order: 3;
        width: 100%;
        display: flex;
        justify-content: space-around; /* Рівномірний розподіл */
        gap: 5px;
        margin-top: 10px;
    }
    .nav-item {
        font-size: 0.85rem;
        white-space: nowrap; /* Щоб "Як це працює" не падало на 2 рядки */
    }
    .lang-switcher {
        margin-right: 0;
        font-size: 0.85rem;
    }

    /* Hero Section */
    .hero {
        padding: 50px 0;
    }
    .hero-title {
        font-size: 2.2rem;
    }
    .hero-subtitle {
        font-size: 1rem;
    }
    .hero-actions {
        flex-direction: column;
        gap: 15px;
    }
    .btn-lg {
        width: 100%;
        padding: 15px;
    }
    .stats {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }

    /* Filters */
    .filters {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    .filter-group {
        width: 100%;
    }

    /* Marketplace and Escrow Grids */
    .marketplace-grid {
        grid-template-columns: 1fr;
    }
    .escrow-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .escrow-visualization {
        position: static;
        margin-top: 20px;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 20px;
        border-radius: 12px;
    }
    .modal-header h3 {
        font-size: 1.5rem;
    }
}
