:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(148, 163, 184, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-hover: #0ea5e9;
    --danger-color: #ef4444;
    --string-color: #a5d6ff;
    --number-color: #7ee787;
    --boolean-color: #ff7b72;
    --key-color: #79c0ff;
    --null-color: #ff7b72;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: #4c1d95;
    top: -100px;
    left: -100px;
    animation: float 10s infinite ease-in-out alternate;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: #0ea5e9;
    bottom: -150px;
    right: -150px;
    animation: float 12s infinite ease-in-out alternate-reverse;
}

@keyframes float {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(30px, 30px);
    }
}

.container {
    width: 95%;
    max-width: 1200px;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
}

.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.nav-tab {
    padding: 0.75rem 1.5rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    backdrop-filter: blur(12px);
}

.nav-tab:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.nav-tab.active {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.editor-container {
    display: flex;
    flex: 1;
    gap: 1rem;
    min-height: 0;
    margin-bottom: 2rem;
}

.panel {
    flex: 1;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.panel-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
}

.editor-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

.line-numbers {
    width: 40px;
    flex-shrink: 0;
    text-align: right;
    padding: 1rem 0.5rem;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.3);
    border-right: 1px solid var(--panel-border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    user-select: none;
}

.label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

textarea,
.output-area {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 1rem;
    padding-left: 0.5rem;
    /* Reduced left padding */
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    overflow: auto;
    white-space: pre !important;
    /* Disable wrapping for line numbers alignment */
}



textarea::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

.controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
}

.primary-btn {
    background: linear-gradient(135deg, #38bdf8, #6366f1);
    color: white;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.secondary-btn {
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
}

.secondary-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--accent-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

/* Syntax Highlighting */
.key {
    color: var(--key-color);
}

.string {
    color: var(--string-color);
}

.number {
    color: var(--number-color);
}

.boolean {
    color: var(--boolean-color);
}

.null {
    color: var(--null-color);
}

.error {
    color: var(--danger-color);
    font-weight: bold;
}

@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
    }

    .controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        width: 100%;
    }

    .container {
        height: auto;
    }

    textarea,
    .output-area {
        min-height: 300px;
    }
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 100;
}

.toast.hidden {
    opacity: 0;
    transform: translate(-50%, 20px);
    pointer-events: none;
}

/* Landing Page Styles */
.landing-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    flex: 1;
    min-height: 50vh;
}

.tool-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 3rem;
    width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 40px rgba(56, 189, 248, 0.2);
}

.card-icon {
    width: 64px;
    height: 64px;
    background: rgba(56, 189, 248, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.tool-card:hover .card-icon {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
}

/* Unified Navigation */
.site-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1.5rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    margin: 0 auto 2rem;
    width: fit-content;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    height: 60px;
    position: relative;
    z-index: 50;
}

.nav-brand img {
    display: block;
    transition: transform 0.2s;
}

.nav-brand:hover img {
    transform: scale(1.1) rotate(5deg);
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--panel-border);
}

/* Dropdown Navigation */
.nav-group {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropbtn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.dropbtn:hover {
    color: var(--text-primary);
}

.dropbtn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.nav-group:hover .dropbtn svg {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    /* Fallback for panel-bg opacity issues if overlapping */
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    min-width: 180px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    z-index: 100;
    backdrop-filter: blur(12px);
    margin-top: 0.5rem;
}

/* Invisible bridge for hover */
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 0;
    width: 100%;
    height: 0.5rem;
}

.nav-group:hover .dropdown-content {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.dropdown-content a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 1rem;
    display: block;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: translateX(4px);
}

.dropdown-content a.active {
    color: var(--accent-color);
    background: rgba(56, 189, 248, 0.1);
}

@media (max-width: 768px) {
    .site-nav {
        flex-direction: column;
        width: 100%;
        gap: 0;
        border-radius: 0;
        margin-bottom: 2rem;
        padding: 1rem;
        height: auto;
    }

    .nav-divider {
        display: none;
    }

    .nav-group {
        width: 100%;
        flex-direction: column;
        height: auto;
    }

    .dropbtn {
        width: 100%;
        justify-content: space-between;
        padding: 1rem;
    }

    .nav-group:hover .dropdown-content {
        position: static;
        transform: none;
        width: 100%;
        margin-top: 0;
        border: none;
        background: transparent;
        box-shadow: none;
        padding-left: 1rem;
    }
}

/* ===================== Footer ===================== */
.site-footer {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2.5% 0;
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 2.5%;
    right: 2.5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #38bdf8, #818cf8, #38bdf8, transparent);
    opacity: 0.5;
}

.footer-inner {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
    gap: 1rem;
    padding-bottom: 1rem;
}

.footer-brand .footer-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    margin-bottom: 0.6rem;
}

.footer-brand .footer-logo img {
    width: 22px;
    height: 22px;
    border-radius: 5px;
}

.footer-brand .footer-logo span {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.footer-tagline {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.55;
    max-width: 240px;
    margin-bottom: 0.8rem;
}

.footer-social {
    display: flex;
    gap: 0.5rem;
}

.social-link {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.25s ease;
}

.social-link:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(56, 189, 248, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15);
}

.footer-col h4 {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.footer-links a::before {
    content: '';
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--panel-border);
    flex-shrink: 0;
    transition: background 0.2s;
}

.footer-links a:hover {
    color: var(--accent-color);
    transform: translateX(4px);
}

.footer-links a:hover::before {
    background: var(--accent-color);
}

.footer-bottom {
    border-top: 1px solid var(--panel-border);
    padding: 0.8rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.footer-copy span {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.footer-badge {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
}

.footer-badge svg {
    color: #ef4444;
}

@media (max-width: 768px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .footer-tagline {
        max-width: 100%;
    }
}