:root {
    /* Base Variables (Dark Theme) */
    --bg-color: #0b0e14;
    --panel-bg: rgba(17, 24, 39, 0.7);
    --border-color: rgba(55, 65, 81, 0.5);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary-color: #3b82f6; 
    --accent-color: var(--primary-color);
    --accent-glow: rgba(59, 130, 246, 0.4);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --success: #10b981;
    --error: #ef4444;
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --input-bg: rgba(0, 0, 0, 0.3);
    --h1-gradient: linear-gradient(to right, #ffffff, #9ca3af);
    --title-color: #ffffff; /* Default for dark */
}

[data-theme="light"] {
    --bg-color: #f3f4f6;
    --panel-bg: rgba(255, 255, 255, 0.9);
    --border-color: rgba(209, 213, 219, 0.8);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --input-bg: #ffffff;
    --h1-gradient: linear-gradient(to right, #111827, #4b5563);
    --title-color: #111827; /* Default for light */
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 4rem 1rem;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.glow-bg {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 850px;
    width: 100%;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 10;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    text-align: center;
    margin-bottom: 1.5rem; /* Reduzido de 3.5rem */
}

.logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0rem; /* Aproximado */
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--title-color); /* Usando variável de cor */
    /* Removido gradiente fixo para permitir cor sólida customizável */
    transition: var(--transition);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all 0.3s;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 10px var(--success); }
.status-dot.offline { background: var(--error); box-shadow: 0 0 10px var(--error); }

.subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
    font-weight: 400;
}

/* Search Box */
.search-box {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    backdrop-filter: blur(16px);
    box-shadow: var(--card-shadow);
    transition: var(--transition), background-color 0.4s ease;
}

.search-box:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), var(--card-shadow);
}

/* Theme Toggle */
.theme-switch {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.theme-switch button {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-switch button:hover {
    background: var(--accent-light);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.logout-minimal {
    color: var(--error) !important;
}

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

textarea {
    width: 100%;
    min-height: 140px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.05rem;
    resize: none;
    transition: all 0.2s;
    outline: none;
    line-height: 1.6;
}

textarea:focus {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(0, 0, 0, 0.4);
}

.actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

button {
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0.9rem 2.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px var(--accent-glow);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.detected-badge {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.2);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Results Viewer */
.results-viewer {
    min-height: 300px;
    position: relative;
}

.placeholder-text {
    color: var(--text-secondary);
    text-align: center;
    font-size: 1.1rem;
    margin-top: 5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
}

.result-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    animation: slideIn 0.4s cubic-bezier(0, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.result-header {
    margin-bottom: 1.5rem;
}

.result-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.badge-bc { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-pc { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-mc { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-fgc { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-gap { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.badge-zoning-resolution { background: rgba(251, 146, 60, 0.2); color: #fb923c; }

[data-theme="light"] .badge-bc { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
[data-theme="light"] .badge-pc { background: rgba(5, 150, 105, 0.1); color: #059669; }
[data-theme="light"] .badge-mc { background: rgba(217, 119, 6, 0.1); color: #d97706; }
[data-theme="light"] .badge-fgc { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
[data-theme="light"] .badge-gap { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
[data-theme="light"] .badge-zoning-resolution { background: rgba(234, 88, 12, 0.1); color: #ea580c; }

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.result-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
}

.highlight {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 600;
}

[data-theme="light"] .highlight {
    background: rgba(37, 99, 235, 0.2);
    color: #1d4ed8;
}

.result-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Loading & Error States */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 5rem;
    gap: 1.5rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-card {
    text-align: center;
    padding: 3rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    color: #f87171;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

footer {
    text-align: center;
    margin-top: 5rem;
    padding-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}
