/* CSS Variables for Theming */
:root {
    --bg-color: #ffffff;
    --text-color: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --filter-bg: #ffffff;
    --btn-bg: #f3f4f6;
    --btn-hover: #e5e7eb;
    --btn-hover-bg-color: #000000; 
    --btn-hover-icon-color: #ffffff; 
    --form-border: #f59e0b;
    --btn-dark-navy: #0f172a;
    --mix-percentage: 8%;
}

body.dark-mode {
    --bg-color: #0a0a0a; 
    --text-color: #ffffff;
    --text-muted: #a3a3a3;
    --border-color: #262626;
    --card-bg: #121212;
    --card-hover-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.5);
    --nav-bg: rgba(10, 10, 10, 0.9);
    --filter-bg: #121212;
    --btn-bg: #1e1e1e;
    --btn-hover: #2d2d2d;
    --btn-hover-bg-color: #ffffff; 
    --btn-hover-icon-color: #000000; 
    --btn-dark-navy: #ffffff;
    --mix-percentage: 12%;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

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

main.container {
    flex: 1;
}

/* Navbar Base Styles */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative; /* Required for the absolute dropdown */
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-links a {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: color 0.2s;
    padding: 8px 0;
}

.nav-links a:hover { color: var(--text-color); }

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 10px 20px !important;
    margin-top: 70px !important;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

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

.footer-links {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.footer-links a {
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: color 0.2s;
    padding: 6px 0;
}

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

/* Home Toolbar (Filters) */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 30px 0;
    padding: 8px;
    background: var(--filter-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    align-items: center;
}

.search-wrapper {
    flex: 1;
    min-width: 260px;
    display: flex;
    align-items: center;
    padding: 0 12px;
}

.search-wrapper input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 12px 6px;
    font-size: 1rem;
    color: var(--text-color);
    outline: none;
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    width: auto;
}

select {
    appearance: none;
    background: var(--btn-bg);
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 10px 36px 10px 14px;
    cursor: pointer;
    outline: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%236b7280" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: background-color 0.2s, border-color 0.2s;
}

body.dark-mode select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23a3a3a3" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
}

select:hover {
    background-color: var(--btn-hover);
}

select option { background: var(--card-bg); color: var(--text-color); }

.theme-toggle {
    background: var(--btn-bg);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    transition: background 0.2s, transform 0.1s active;
}

.theme-toggle:hover { background: var(--btn-hover); }
.theme-toggle:active { transform: scale(0.95); }

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding-bottom: 60px;
}

/* Domain Card (Uses CSS color-mix instead of JS tints) */
.card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: linear-gradient(115deg, color-mix(in srgb, var(--theme-color) var(--mix-percentage), var(--card-bg)) 0%, var(--card-bg) 70%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--theme-color); 
}

.domain-name {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.domain-ext { font-weight: 600; }

.arrow-btn {
    background: var(--btn-bg);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.card:hover .arrow-btn {
    background-color: var(--btn-hover-bg-color);
    color: var(--btn-hover-icon-color);
}

.arrow-icon-hover, .card:hover .arrow-icon-default { display: none; }
.card:hover .arrow-icon-hover { display: block; }

/* Single Product View (Mobile Responsive Overhaul) */
.product-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(40px, 10vh, 100px) 0;
    max-width: 680px;
    margin: 0 auto;
}

.sale-badge {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 16px;
}

/* Fluid Typography prevents overflow clipping on small viewports */
.display-domain {
    font-size: clamp(2.2rem, 8vw, 4.2rem);
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
    line-height: 1.1;
    word-break: break-word;
}

.product-description {
    font-size: clamp(1rem, 3vw, 1.15rem);
    color: var(--text-muted);
    margin-bottom: 40px;
    line-height: 1.6;
}

/* Feature Badges Layout */
.features {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin: 16px 0 36px 0;
    flex-wrap: wrap; /* Keeps them looking good if they squeeze onto a small mobile screen */
}

.feature {
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-color);
}

.feature svg {
    width: 20px;
    height: 20px;
    /* This line automatically changes the checkmark color to match the domain extension! */
    color: var(--theme-color, var(--text-color)); 
}

/* Mobile-ready single row form layout */
.offer-form {
    max-width: 450px;
    display: flex;
    align-items: center;
    /* Uses the dynamic color injected from JS, falls back to gray if missing */
    border: 2px solid var(--theme-color, var(--border-color)); 
    border-radius: 20px; /* Perfect pill shape from your design */
    padding: 6px 6px 6px 24px; /* Pushes the USD label slightly inward */
    background: transparent;
    margin-bottom: 20px;
    transition: border-color 0.2s ease;
}

.currency-label {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-right: 12px;
}

.offer-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: var(--text-color);
    outline: none;
    font-weight: 600;
    width: 100%;
    /* This line completely removes spinners in Firefox */
    -moz-appearance: textfield; 
    appearance: textfield;
}

/* This block removes spinners in Chrome, Safari, Edge, and Opera */
.offer-input::-webkit-outer-spin-button,
.offer-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.submit-offer-btn {
    background: var(--btn-dark-navy);
    color: var(--bg-color); /* Automatically handles Light/Dark text inversion */
    border: none;
    border-radius: 14px; /* Matches outer pill shape radius */
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: opacity 0.15s ease, transform 0.1s;
}

.submit-offer-btn:hover { opacity: 0.9; }
.submit-offer-btn:active { transform: scale(0.98); }

.terms-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.terms-text a { text-decoration: underline; }

/* Hidden by default on desktop */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 4px;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block; /* Show hamburger */
    }
    .nav-links {
        display: none; /* Hide standard row */
        flex-direction: column;
        position: absolute;
        top: 100%; /* Drops exactly beneath the border */
        left: -20px; /* Expand past the container padding */
        right: -20px;
        background-color: var(--bg-color); /* Solid background blocks out main content */
        padding: 24px 20px;
        gap: 20px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
        z-index: 100;
        text-align: center;
    }

    .nav-links.active {
        display: flex; /* Shown when JS toggles the class */
    }

    .nav-links a {
        font-size: 1.1rem; /* Slightly larger touch targets on mobile */
        width: 100%;
        padding: 12px 0;
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    .search-wrapper {
        border-right: none;
        padding: 0;
    }
    .filters {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        display: grid;
        width: 100%;
    }
    select {
        width: 100%;
    }
    .theme-toggle {
        grid-column: span 2;
        width: 100%;
        border-radius: 10px;
    }
    .footer-container {
        flex-direction: column-reverse;
        text-align: center;
        gap: 24px;
    }
    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    nav { padding: 16px 0; }
    .nav-links { gap: 16px; }
    .offer-form {
        flex-direction: column;
        border-radius: 20px;
        padding: 16px;
        align-items: stretch;
        gap: 12px;
    }
    .currency-label { margin-right: 0; }
    .offer-input {
        text-align: center;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 8px;
    }
    .submit-offer-btn {
        justify-content: center;
        border-radius: 14px;
    }
}