/* =============================
   DataShift — JSON ↔ CSV Converter
   DARTH VADER EDITION
   Deep black / Imperial red / Gunmetal steel
   ============================= */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #050505;
    --bg-secondary: #0c0c0c;
    --bg-card: rgba(12, 12, 12, 0.85);
    --bg-panel: rgba(8, 8, 8, 0.95);
    --border: rgba(200, 30, 30, 0.12);
    --border-hover: rgba(200, 30, 30, 0.35);
    --text-primary: #d4d4d4;
    --text-secondary: #707070;
    --text-muted: #444444;
    --accent: #c41e1e;
    --accent-light: #e03030;
    --accent-glow: rgba(200, 30, 30, 0.2);
    --accent-dark: #8b1515;
    --steel: #2a2a2a;
    --steel-light: #383838;
    --green: #22c55e;
    --red: #c41e1e;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 8px;
    --radius-sm: 6px;
    --transition: 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background — subtle dark grid */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(200, 30, 30, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200, 30, 30, 0.02) 1px, transparent 1px);
    background-size: 80px 80px;
    pointer-events: none;
    z-index: 0;
}

.glow {
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(180px);
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

.glow-1 {
    background: var(--accent);
    top: -250px;
    left: -150px;
    animation: floatGlow 14s ease-in-out infinite alternate;
}

.glow-2 {
    background: var(--accent-dark);
    bottom: -250px;
    right: -150px;
    animation: floatGlow 18s ease-in-out infinite alternate-reverse;
}

@keyframes floatGlow {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(40px, 30px);
    }
}

/* Header */
header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    background: rgba(5, 5, 5, 0.9);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
}

nav {
    display: flex;
    gap: 24px;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: color var(--transition);
}

nav a:hover {
    color: var(--accent-light);
}

/* Main */
main {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 48px;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 4px;
    background: rgba(200, 30, 30, 0.08);
    border: 1px solid rgba(200, 30, 30, 0.2);
    color: var(--accent-light);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.accent {
    color: var(--accent-light);
    -webkit-text-fill-color: var(--accent-light);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Converter Card */
.converter-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.converter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-dark), transparent);
    opacity: 0.6;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    position: relative;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--steel);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 28px;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

.mode-btn {
    flex: 1;
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: color var(--transition);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mode-btn.active {
    color: var(--text-primary);
}

.toggle-indicator {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: rgba(200, 30, 30, 0.12);
    border: 1px solid rgba(200, 30, 30, 0.25);
    border-radius: var(--radius-sm);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.mode-toggle.csv-mode .toggle-indicator {
    transform: translateX(100%);
}

/* Panels */
.panels {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: stretch;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--steel);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color var(--transition);
}

.panel:hover {
    border-color: var(--border-hover);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--steel);
    background: rgba(200, 30, 30, 0.03);
}

.panel-header h2 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-light);
}

.panel-actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(200, 30, 30, 0.06);
    border: 1px solid var(--steel);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.icon-btn:hover {
    background: rgba(200, 30, 30, 0.12);
    color: var(--text-primary);
    border-color: rgba(200, 30, 30, 0.3);
}

.icon-btn.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.25);
}

textarea {
    flex: 1;
    min-height: 300px;
    padding: 16px 18px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    resize: none;
    outline: none;
    tab-size: 2;
}

textarea::placeholder {
    color: var(--text-muted);
}

textarea::-webkit-scrollbar {
    width: 4px;
}

textarea::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background: rgba(200, 30, 30, 0.2);
    border-radius: 2px;
}

.panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-top: 1px solid var(--steel);
}

.stats {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(200, 30, 30, 0.06);
    border: 1px solid var(--steel);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.file-upload:hover {
    background: rgba(200, 30, 30, 0.12);
    color: var(--text-primary);
}

.file-upload input[type="file"] {
    display: none;
}

/* Convert Button */
.convert-section {
    display: flex;
    align-items: center;
    justify-content: center;
}

.convert-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--accent);
    border: 1px solid var(--accent-light);
    border-radius: var(--radius);
    color: white;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 24px rgba(200, 30, 30, 0.25);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.convert-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.convert-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 40px rgba(200, 30, 30, 0.4);
    background: var(--accent-light);
}

.convert-btn:hover::before {
    opacity: 1;
}

.convert-btn:active {
    transform: scale(0.98);
}

.convert-btn.converting {
    pointer-events: none;
}

.btn-arrow {
    transition: transform var(--transition);
}

.convert-btn:hover .btn-arrow {
    transform: translateX(3px);
}

/* Error Bar */
.error-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    margin-top: 16px;
    background: rgba(200, 30, 30, 0.08);
    border: 1px solid rgba(200, 30, 30, 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-light);
    font-size: 0.85rem;
    animation: slideIn 0.3s ease;
}

.error-bar.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Features */
.features {
    margin-top: 80px;
    text-align: center;
}

.features h2 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    margin-bottom: 40px;
    text-transform: uppercase;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--steel);
    border-radius: var(--radius);
    padding: 28px 24px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(200, 30, 30, 0.08);
}

.feature-icon {
    font-size: 1.4rem;
    margin-bottom: 14px;
}

.feature-card h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.feature-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* FAQ */
.faq {
    margin-top: 80px;
}

.faq h2 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    margin-bottom: 32px;
    text-align: center;
    text-transform: uppercase;
}

.faq-list {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--steel);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition);
}

.faq-item:hover {
    border-color: var(--border-hover);
}

.faq-item summary {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.2rem;
    color: var(--accent);
    transition: transform var(--transition);
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 20px 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.faq-item code {
    background: rgba(200, 30, 30, 0.08);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-light);
}

/* Footer */
footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 32px;
    border-top: 1px solid var(--steel);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

footer strong {
    color: var(--accent-light);
}

/* Responsive */
@media (max-width: 800px) {
    header {
        padding: 16px 20px;
    }

    main {
        padding: 24px 16px 60px;
    }

    .converter-card {
        padding: 20px 16px;
    }

    .panels {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .convert-section {
        padding: 8px 0;
    }

    .convert-btn {
        width: 100%;
        justify-content: center;
    }

    textarea {
        min-height: 200px;
    }
}