:root {
    --bg-color: #0d0d0d;
    --text-color: #e0e0e0;
    --accent-color: #7289da;
    --accent-hover: #5b6eae;
    --input-bg: #1a1a1a;
    --input-border: #333;
    --nav-bg: #111;
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* TOP NAV */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    height: 50px;
    background-color: transparent;
    /* Transparent to blend */
    position: absolute;
    /* Floating header for immersive feel */
    width: 100%;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
}

.nav-tabs {
    display: flex;
    gap: 1.5rem;
}

.nav-tab {
    background: transparent;
    border: none;
    color: #888;
    padding: 0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.nav-tab:hover {
    color: #fff;
}

.nav-tab.active {
    color: #fff;
    border-bottom: 1px solid #fff;
}

.nav-right {
    display: flex;
    align-items: center;
}

.lang-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #888;
    transition: 0.3s;
    cursor: pointer;
}

.lang-wrapper:hover {
    color: #fff;
}

.lang-select {
    background: transparent;
    color: inherit;
    border: none;
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    /* Remove default arrow */
    text-align: right;
}

.lang-select option {
    background: #222;
    color: #fff;
}

/* MAIN CONTAINER */
.main-container {
    flex: 1;
    width: 100%;
    max-width: 800px;
    /* Wider for usage */
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.view-section {
    width: 100%;
    animation: fadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
}

.view-section.hidden {
    display: none;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* PROXY VIEW STYLES */
.header {
    margin-bottom: 2rem;
    margin-top: 2rem;
}

.header .logo {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.header .highlight {
    color: var(--accent-color);
    font-weight: 300;
}

.tagline {
    font-size: 0.9rem;
    color: #666;
    font-family: var(--font-mono);
}

.search-engine-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.se-option {
    cursor: pointer;
    position: relative;
}

.se-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.se-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: #151515;
    border: 1px solid #333;
    color: #666;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.se-option:hover .se-label {
    border-color: #555;
    color: #999;
}

.se-option input[type="radio"]:checked+.se-label {
    background: rgba(114, 137, 218, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 10px rgba(114, 137, 218, 0.1);
}

.proxy-form {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 0.5rem;
    transition: 0.3s;
}

.input-group:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(114, 137, 218, 0.2);
}

.mode-select,
.url-input {
    background: transparent;
    border: none;
    font-family: var(--font-mono);
    outline: none;
}

.mode-select {
    color: var(--accent-color);
    padding: 0 1rem;
    border-right: 1px solid #333;
    cursor: pointer;
}

.mode-select option {
    background: var(--input-bg);
    color: #fff;
}

.url-input {
    flex: 1;
    color: #fff;
    padding: 0.8rem 1rem;
    font-size: 1rem;
}

.go-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.go-btn:hover {
    background: var(--accent-hover);
}

.quick-links {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.quick-link {
    background: transparent;
    border: 1px solid #333;
    color: #888;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.3s;
}

.quick-link:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(114, 137, 218, 0.05);
}

/* USAGE VIEW STYLES */
.usage-layout {
    text-align: left;
    max-width: 700px;
    margin: 0 auto;
    margin-top: 1rem;
}

.usage-layout h2 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.step-card {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: #151515;
    padding: 1.2rem;
    border-radius: 10px;
    border: 1px solid #222;
}

.step-num {
    background: #333;
    color: #fff;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.step-text h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    color: #ddd;
}

.step-text p {
    font-size: 0.9rem;
    color: #888;
}

.alert-box {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
    padding: 1rem;
    border-radius: 8px;
    margin: 2rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* CHANGELOG STYLES */
.changelog-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #151515;
    border: 1px solid #222;
    border-radius: 12px;
}

.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

.version-tag {
    background: var(--accent-color);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    font-family: var(--font-mono);
}

.changelog-date {
    font-size: 0.8rem;
    color: #666;
    font-family: var(--font-mono);
}

.changelog-list {
    list-style: none;
    padding-left: 0.5rem;
}

.changelog-list li {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.2rem;
}

.changelog-list li::before {
    content: "•";
    color: var(--accent-color);
    position: absolute;
    left: 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.comparison-table th {
    text-align: left;
    color: #666;
    padding: 0.8rem;
    border-bottom: 1px solid #333;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.comparison-table td {
    padding: 1rem 0.8rem;
    border-bottom: 1px solid #222;
    color: #ccc;
}

.footer {
    margin-top: auto;
    padding: 2rem 0;
    font-size: 0.75rem;
    color: #444;
}

.version-badge {
    margin-top: 1rem;
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: #111;
    border: 1px solid #222;
    color: #555;
    font-family: var(--font-mono);
}

.footer-nav a {
    color: #666;
    text-decoration: none;
    margin: 0 0.5rem;
}

.footer-nav a:hover {
    color: var(--accent-color);
}

/* HISTORY STYLES */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.refresh-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #888;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.refresh-btn:hover {
    background: #222;
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.history-subtitle {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.history-item {
    background: #111;
    border: 1px solid #222;
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, border-color 0.2s;
}

.history-item:hover {
    border-color: #444;
    transform: translateX(5px);
}

.history-url {
    font-size: 0.9rem;
    color: #aaa;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.history-item:hover .history-url {
    color: var(--accent-color);
}

.history-go {
    background: transparent;
    border: none;
    color: #444;
    cursor: pointer;
}

.history-item:hover .history-go {
    color: var(--accent-color);
}

.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: #444;
    font-family: var(--font-mono);
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    .search-engine-selector {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .top-nav {
        padding: 0 1rem;
    }

    .nav-tabs {
        gap: 0;
    }

    .nav-tab {
        padding: 0.5rem 0.8rem;
    }

    .input-group {
        flex-direction: column;
        padding: 0.8rem;
        gap: 0.5rem;
    }

    .mode-select {
        border-right: none;
        border-bottom: 1px solid #333;
        padding: 0.5rem 0;
    }

    .go-btn {
        width: 100%;
        padding: 0.8rem;
    }
}

/* --- AI CHATBOT STYLES --- */
.ai-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--accent-color, #6366f1);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-bubble:hover {
    transform: scale(1.1) rotate(5deg);
}

.ai-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 450px;
    background: rgba(13, 13, 13, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.ai-window.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.ai-header {
    background: var(--accent-color, #6366f1);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-name {
    font-weight: bold;
    font-size: 1rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.ai-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message.system {
    align-self: flex-start;
    background: #252525;
    color: #eee;
    border-bottom-left-radius: 2px;
}

.message.user {
    align-self: flex-end;
    background: var(--accent-color, #6366f1);
    color: white;
    border-bottom-right-radius: 2px;
}

.ai-input-group {
    padding: 15px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
}

#ai-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 8px 12px;
    color: white;
    font-size: 0.9rem;
}

#send-ai {
    background: var(--accent-color, #6366f1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 480px) {
    .ai-window {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 90px;
    }
}