/* ================================================================
   criscuolo.online — Indentador de Código
   ================================================================ */

:root {
    --brand-gold: #D4A843;
    --brand-gold-light: #E0BE6A;
    --brand-gold-dark: #B8922F;
    --brand-gradient: linear-gradient(135deg, #D4A843, #E0BE6A, #D4A843);
    --cta-gradient: linear-gradient(135deg, #D4A843, #B8922F);

    --bg-primary: #16161E;
    --bg-secondary: #1C1C26;
    --bg-card: rgba(24, 24, 32, 0.88);
    --bg-card-border: rgba(212, 168, 67, 0.12);
    --bg-card-border-hover: rgba(212, 168, 67, 0.3);
    --bg-input: #141420;
    --bg-hover: rgba(212, 168, 67, 0.08);

    --text-primary: #F2F0EB;
    --text-secondary: #9B978E;
    --text-muted: #6B6760;
    --text-accent: #D4A843;

    --color-success: #22C55E;
    --color-error: #EF4444;

    --border-radius: 16px;
    --border-radius-sm: 10px;
    --border-radius-xs: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-glow: 0 0 40px rgba(212, 168, 67, 0.1);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-button: 0 4px 15px rgba(212, 168, 67, 0.25);
    --shadow-button-hover: 0 6px 25px rgba(212, 168, 67, 0.35);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* ================================================================
   Reset
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
textarea, select, input { font-family: var(--font); }

/* ================================================================
   Fundo decorativo
   ================================================================ */
.bg-effects {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
}
.orb-1 { width: 600px; height: 600px; background: radial-gradient(circle, rgba(212,168,67,0.18) 0%, transparent 70%); top: -200px; right: -100px; }
.orb-2 { width: 500px; height: 500px; background: radial-gradient(circle, rgba(184,146,47,0.12) 0%, transparent 70%); bottom: -150px; left: -100px; }
.orb-3 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(212,168,67,0.08) 0%, transparent 70%); top: 40%; left: 30%; }
.orb-4 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(224,190,106,0.1) 0%, transparent 70%); bottom: 10%; right: 20%; }

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(212,168,67,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212,168,67,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ================================================================
   Mouse Glow
   ================================================================ */
.mouse-glow {
    position: fixed;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212,168,67,0.06) 0%, rgba(212,168,67,0.02) 40%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.mouse-glow.visible { opacity: 1; }

/* ================================================================
   Header
   ================================================================ */
.header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    padding: 0 24px;
    background: rgba(22,22,30,.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(212,168,67,.08);
    transition: var(--transition);
}
.header.scrolled { background: rgba(22,22,30,.95); border-bottom-color: rgba(212,168,67,.15); }

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-img-wrapper {
    width: 44px; height: 44px;
    background: radial-gradient(circle,rgba(255,255,255,.95) 60%,rgba(255,255,255,.6) 80%,transparent 100%);
    border-radius: 50%; padding: 5px;
    box-shadow: 0 0 16px rgba(212,168,67,.15);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: var(--transition);
}
.logo-img-wrapper:hover { box-shadow: 0 0 24px rgba(212,168,67,.25); }

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.logo-text-group {
    display: flex;
    align-items: baseline;
    gap: 0;
}

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

.logo-text-accent {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand-gold);
    letter-spacing: -0.02em;
}

/* Nav */
.nav { display: flex; align-items: center; gap: 8px; }
.nav-link { font-size: .9rem; font-weight: 600; color: var(--text-secondary); padding: 8px 14px; border-radius: var(--border-radius-xs); transition: var(--transition); }
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link-active { color: var(--brand-gold) !important; background: rgba(212,168,67,.08); }
.nav-cta { font-size: .9rem; font-weight: 700; color: #0C0C0E; background: var(--cta-gradient); padding: 9px 18px; border-radius: var(--border-radius-sm); box-shadow: var(--shadow-button); transition: var(--transition); margin-left: 8px; }
.nav-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-button-hover); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* ================================================================
   Utilities
   ================================================================ */
.gradient-text {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-gold);
    margin-bottom: 8px;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 12px;
    transition: var(--transition);
}

.breadcrumb:hover { color: var(--text-secondary); }

/* ================================================================
   Layout principal (fill viewport)
   ================================================================ */
.formatter-main {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Hero compacto */
.page-hero-compact {
    flex-shrink: 0;
    padding: 72px 24px 16px;
    border-bottom: 1px solid var(--bg-card-border);
    background: rgba(22, 22, 30, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.page-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.hero-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.page-title {
    font-size: clamp(1.3rem, 3vw, 1.9rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-top: 4px;
}

.page-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    max-width: 420px;
    line-height: 1.5;
}

/* ================================================================
   Seção do formatter
   ================================================================ */
.formatter-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Toolbar */
.formatter-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-card-border);
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Select */
.tool-select {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--border-radius-xs);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 7px 10px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    max-width: 210px;
}

.tool-select option, .tool-select optgroup {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tool-select:focus { border-color: var(--brand-gold-dark); }

.tool-select-sm { max-width: 120px; }

/* Buttons */
.btn-tool {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--border-radius-xs);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-tool:hover {
    border-color: var(--bg-card-border-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-format {
    background: var(--cta-gradient);
    border-color: transparent;
    color: #0C0C0E;
    box-shadow: var(--shadow-button);
}

.btn-format:hover {
    box-shadow: var(--shadow-button-hover);
    color: #0C0C0E;
}

/* Mobile tabs */
.view-tabs {
    display: none;
    flex-shrink: 0;
    border-bottom: 1px solid var(--bg-card-border);
    background: var(--bg-secondary);
}

.view-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.view-tab.active {
    color: var(--brand-gold);
    border-bottom-color: var(--brand-gold);
}

/* ================================================================
   Painéis
   ================================================================ */
.formatter-panes {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.pane-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 16px;
    background: rgba(28, 28, 38, 0.7);
    border-bottom: 1px solid var(--bg-card-border);
}

.pane-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 7px;
}

.pane-info {
    font-size: 0.73rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.code-editor {
    flex: 1;
    width: 100%;
    background: #111118;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.855rem;
    line-height: 1.65;
    padding: 16px 20px;
    resize: none;
    tab-size: 4;
    -moz-tab-size: 4;
}

.code-editor::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.code-output {
    background: #0e0e16;
    cursor: default;
}

/* Live dot */
.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success);
    display: inline-block;
    opacity: 0;
    transition: opacity 0.3s;
    flex-shrink: 0;
}

.live-dot.active {
    opacity: 1;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

/* Divisor arrastável */
.pane-divider {
    flex-shrink: 0;
    width: 5px;
    background: var(--bg-card-border);
    cursor: col-resize;
    transition: background 0.2s;
    position: relative;
    user-select: none;
}

.pane-divider::after {
    content: '';
    position: absolute;
    inset: 0 -6px;
}

.pane-divider:hover,
.pane-divider.dragging {
    background: rgba(212, 168, 67, 0.35);
}

/* ================================================================
   Toast
   ================================================================ */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 30, 40, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bg-card-border);
    border-radius: 40px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 999;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast svg { color: var(--color-success); flex-shrink: 0; }
.toast.error svg { color: var(--color-error); }

/* ================================================================
   Responsivo
   ================================================================ */
@media (max-width: 900px) {
    .page-subtitle { display: none; }
}

@media (max-width: 640px) {
    .nav { display: none; position: fixed; top: 72px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: rgba(22,22,30,.98); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 16px; border-bottom: 1px solid var(--bg-card-border); gap: 4px; }
    .nav.open { display: flex; }
    .nav-toggle { display: flex; }
    .nav-cta { margin-left: 0; text-align: center; }
    .hero-row { flex-direction: column; gap: 4px; }
    .view-tabs { display: flex; }
    .pane-divider { display: none; }
    .pane { display: none; }
    .pane.pane-active { display: flex; }
    .btn-label { display: none; }
    .tool-select { max-width: 160px; font-size: 0.78rem; }
    .formatter-toolbar { padding: 8px 12px; gap: 8px; }
    .page-hero-compact { padding: 68px 16px 12px; }
    .page-title { font-size: 1.3rem; }
}
