/* =========================================================================
   VARIÁVEIS DE COR E TIPOGRAFIA (Sleek Interface)
   ========================================================================= */
:root {
    --color-bg: #0F172A; /* slate-900 */
    --color-surface: #111827; /* gray-900 / sidebar */
    --color-surface-dim: #1F2937; /* gray-800 / inputs */
    --color-surface-border: #334155; /* slate-700 */
    --color-surface-divider: #1E293B; /* slate-800 */
    --color-surface-header: #1E293B; /* top navbar */
    
    --color-primary: #2563EB; /* blue-600 */
    --color-primary-hover: #1D4ED8; /* blue-700 */
    --color-primary-light: rgba(37, 99, 235, 0.1);
    
    --color-text-main: #E2E8F0; /* slate-200 */
    --color-text-muted: #94A3B8; /* slate-400 */
    --color-text-label: #64748B; /* slate-500 */
    
    --color-error: #EAB308; /* yellow-500 */
    --color-error-bg: rgba(234, 179, 8, 0.1);
    --color-error-border: rgba(234, 179, 8, 0.2);

    --color-accent-emerald: #34D399; /* emerald-400 */
    --color-accent-blue: #60A5FA; /* blue-400 */
    
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Geist', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --spacing-1: 4px;
    --spacing-2: 8px;
    --spacing-3: 16px;
    --spacing-4: 24px;
    --spacing-5: 32px;
}

/* =========================================================================
   RESETS E BASE
   ========================================================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, .result-value span {
    font-family: var(--font-display);
    font-weight: 600;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg); 
}
::-webkit-scrollbar-thumb {
    background: var(--color-surface-border); 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-label); 
}

/* =========================================================================
   LAYOUT PRINCIPAL
   ========================================================================= */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-surface-header);
    border-bottom: 1px solid var(--color-surface-divider);
    height: 56px;
    padding: 0 var(--spacing-4);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-2);
}

.logo::before {
    content: 'EP';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--color-primary);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.875rem;
    color: #ffffff;
}

.logo h1 {
    font-size: 0.875rem;
    color: #F1F5F9; /* slate-100 */
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.logo span {
    font-size: 0.875rem;
    color: var(--color-text-label);
    font-weight: 400;
}

.nav-links span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    display: flex;
    align-items: center;
}

.nav-links span.active::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #22C55E; /* green-500 */
    border-radius: 50%;
    margin-right: 8px;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    margin: 0;
    max-width: 100%;
}

.page-header {
    display: none; /* Substituído pelo visual técnico do theme */
}

.grid-layout {
    display: flex;
    flex-direction: row;
    height: 100%;
}

.input-column {
    width: 320px;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-surface-divider);
    padding: var(--spacing-4);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.output-column {
    flex: 1;
    padding: var(--spacing-5);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: var(--spacing-4);
    overflow-y: auto;
}

/* =========================================================================
   CARDS E FORMS (SIDEBAR)
   ========================================================================= */
.input-column .card {
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.input-column .card:not(:first-child) {
    border-top: 1px solid var(--color-surface-divider);
    padding-top: var(--spacing-3);
    margin-top: var(--spacing-3);
}

.card-header {
    margin-bottom: var(--spacing-2);
    display: block;
}

.card-header .material-symbols-outlined, 
.card-header .badge {
    display: none;
}

.card-header h3 {
    font-size: 0.625rem; /* 10px */
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--color-text-label);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.full-width {
    grid-column: 1 / -1;
}

.border-top {
    border-top: 1px solid var(--color-surface-divider);
}

.pt-4 { padding-top: var(--spacing-3); }
.mt-4 { margin-top: 0; }

label {
    font-size: 0.625rem; /* 10px */
    font-weight: 600;
    color: var(--color-text-label);
    text-transform: capitalize;
}

input, select {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 6px 12px;
    border: 1px solid var(--color-surface-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface-dim);
    color: var(--color-text-main);
    transition: all 0.2s ease;
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394A3B8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
    padding-right: 32px;
}

input:disabled, .disabled-input {
    background-color: rgba(31, 41, 55, 0.5);
    color: var(--color-text-label);
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

/* =========================================================================
   MENSAGENS DE VALIDAÇÃO
   ========================================================================= */
.validation-message {
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
    background-color: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
    color: var(--color-error);
    padding: 8px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

.validation-message .material-symbols-outlined {
    display: none;
}

.validation-message span {
    font-size: 0.625rem;
    line-height: 1.2;
}

/* =========================================================================
   ÁREA DE OUTPUT (DIREITA)
   ========================================================================= */
.output-column > section.card {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
}

.output-column .card-header.space-between {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: var(--spacing-4);
}

.output-column .card-header.space-between h3 {
    font-size: 0.75rem; /* 12px */
    color: var(--color-text-label);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.output-column .card-header.space-between .badge {
    display: block;
    background: transparent;
    color: #F1F5F9;
    font-size: 1.5rem; /* 24px */
    font-style: italic;
    font-weight: 300;
    text-transform: none;
    padding: 0;
}

.visualizer-container {
    flex-grow: 1;
    background-color: #020617; /* slate-950 */
    border: 1px solid var(--color-surface-divider);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-5);
    position: relative;
    overflow: hidden;
    min-height: 350px;
}

.visualizer-container::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image: radial-gradient(#475569 1px, transparent 1px);
    background-size: 20px 20px;
}

.book-representation {
    position: relative;
    display: flex;
    align-items: stretch;
    height: 256px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    background: transparent;
    border: none;
    z-index: 10;
}

.book-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 16px 8px;
    position: relative;
    transition: flex-basis 0.3s ease;
}

.orelha {
    flex-basis: 12%; 
    background-color: rgba(30, 41, 59, 0.8);
}
.bg-white {
    background-color: rgba(51, 65, 85, 0.8);
    flex-basis: 34%;
}
.bg-primary {
    background-color: rgba(59, 130, 246, 0.9);
}

.dashed-right { border-right: 1px solid var(--color-surface-border); }
.dashed-left { border-left: 1px solid var(--color-surface-border); }
.border-right { border-right: 1px solid #475569; }
.border-left { border-left: 1px solid #475569; }

.lombada {
    flex-basis: 8%;
    border-left: 1px solid rgba(96, 165, 250, 0.5);
    border-right: 1px solid rgba(96, 165, 250, 0.5);
    box-shadow: none;
    justify-content: center;
}

.canaleta {
    width: 6px;
    background: transparent;
    border-left: 1px dashed var(--color-surface-border);
    border-right: 1px dashed var(--color-surface-border);
}

.part-label {
    font-size: 0.5625rem; /* 9px */
    color: var(--color-text-main);
    font-weight: 400;
    text-transform: uppercase;
}
.part-label.rotated {
    transform: rotate(-90deg);
    transform-origin: center;
    white-space: nowrap;
}
.lombada .part-label {
    color: #172554; /* blue-950 */
    font-weight: 700;
}

.part-value {
    position: static;
    font-family: var(--font-mono);
    color: #93C5FD;
    font-size: 0.625rem;
}
.lombada .part-value {
    display: none;
}

.text-white { color: #ffffff; }
.text-muted { color: #9ca3af; }

.visualizer-footer { display: none; }

/* =========================================================================
   ÁREA DE RESULTADOS (BOTÕES INFERIORES)
   ========================================================================= */
.results-grid {
    display: contents; /* Unwraps results-grid so its children become grid items */
}

.result-card, .summary-card {
    background-color: var(--color-surface-header); /* #1E293B */
    border: 1px solid var(--color-surface-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 128px;
    padding: 0;
    transition: all 0.2s;
    cursor: default;
}

.result-card:hover {
    background-color: #243347;
}

.result-card .result-label { display: none; }

.result-card .result-value { order: 0; text-align: center; }

.result-value span {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--color-text-main);
}
.result-card:nth-child(1) .result-value span { color: var(--color-accent-blue); }
.result-card:nth-child(2) .result-value span { color: var(--color-accent-emerald); }

.result-value small {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--color-text-main);
    margin: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:active { transform: scale(0.98); }

.item-copiar-text {
    font-size: 0.625rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

/* Card 1: Lombada */
.result-card:nth-child(1) .btn-outline { 
    color: var(--color-text-label); 
    background: transparent; border: none; padding: 0; margin: 0 0 8px 0; order: -1; 
}
.result-card:nth-child(1):hover .btn-outline { color: var(--color-accent-blue); }

/* Card 2: Capa Aberta */
.result-card:nth-child(2) .btn-outline { 
    color: var(--color-text-label); 
    background: transparent; border: none; padding: 0; margin: 0 0 8px 0; order: -1; 
}
.result-card:nth-child(2):hover .btn-outline { color: var(--color-accent-emerald); }

/* Hide inner original elements */
.btn.btn-outline .material-symbols-outlined { display: none; }
.btn.btn-outline { font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }

/* Summary Card */
.summary-card {
    background-color: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.5);
    text-align: center;
}
.summary-card:hover {
    background-color: rgba(37, 99, 235, 0.2);
}

.summary-card .summary-info { order: 1; }
.summary-info .icon-large { display: none; }
.summary-info h4 { display: none; }
.summary-info p {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.2;
}

.summary-card .btn-primary { 
    order: -1; 
    background: transparent; 
    border: none;
    color: var(--color-accent-blue); 
    font-size: 0.625rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    padding: 0; 
    margin-bottom: 8px; 
}

/* =========================================================================
   ESTILOS DE ESTADO (DISABLE/SUCCESS)
   ========================================================================= */
.text-success { color: var(--color-accent-emerald) !important; }
.disabled-overlay {
    opacity: 0.5;
    pointer-events: none;
}
