:root {
    /* Tema Claro (Parchment / Corporate Light) */
    --color-bg-main: #fdfbf7;
    --color-surface: rgba(255, 255, 255, 0.85);
    --color-text-main: #222222;
    --color-text-muted: #666666;
    --color-primary: #4a2c5a; /* Púrpura Imperial */
    --color-primary-dark: #311c3d;
    --color-accent: #c87d4a; /* Cobre */
    
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow-soft: 0 10px 40px rgba(74, 44, 90, 0.1);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 15px rgba(200, 125, 74, 0.3);
    
    --border-radius-lg: 16px;
    --border-radius-md: 6px;
    
    --transition-fast: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-slow: 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body.dark-theme {
    /* Tema Escuro: Corporate Witchcraft (Dark Academia Premium) */
    --color-bg-main: #0c0a10; /* Obsidiana / Plum Night */
    --color-surface: rgba(18, 15, 24, 0.75); /* Vidro Fumê Escuro */
    --color-text-main: #F3F1ED;
    --color-text-muted: #9E9B96;
    --color-primary: #d4af37; /* Ouro Velho */
    --color-primary-dark: #aa8c2c;
    --color-accent: #c87d4a; /* Cobre Brilhante */
    
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.8);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.15);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
    line-height: 1.6;
    min-height: 100vh;
    background-image: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.05) 0%, transparent 70%);
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Custom Scrollbar Elegante */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-main);
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.7);
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--color-text-main);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Floating Actions Dock */
.floating-actions {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 100;
}

.floating-btn {
    background: var(--color-surface);
    color: var(--color-text-main);
    border: 1px solid rgba(212, 175, 55, 0.15);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
}

.floating-btn:hover {
    transform: rotate(10deg) scale(1.05);
    box-shadow: var(--shadow-glow);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* History Sidebar */
.history-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 320px;
    height: 100vh;
    background: var(--color-surface);
    backdrop-filter: blur(15px);
    border-left: 1px solid rgba(212, 175, 55, 0.1);
    box-shadow: -5px 0 30px rgba(0,0,0,0.3);
    z-index: 200;
    transition: right var(--transition-slow);
    padding: 2.5rem;
    overflow-y: auto;
}

.history-sidebar.active {
    right: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    padding-bottom: 1rem;
}

.history-header h3 {
    font-size: 1.3rem;
    color: var(--color-primary);
    font-weight: 400;
}

#close-history {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

#close-history:hover {
    color: var(--color-primary);
}

.history-item {
    padding: 1.2rem;
    border: 1px solid rgba(212, 175, 55, 0.1);
    border-radius: var(--border-radius-md);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    background: rgba(0,0,0,0.1);
}

.history-item:hover {
    border-color: var(--color-primary);
    background: rgba(212, 175, 55, 0.05);
    box-shadow: var(--shadow-glow);
}

.history-item h4 {
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.history-item p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-family: var(--font-body);
}

/* Hero Section */
.hero-section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem 0;
    transition: opacity 0.5s ease, height 0.5s ease;
}

.hero-section.minimized {
    min-height: 20vh;
    padding: 1rem 0;
}

.glass-panel {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(212, 175, 55, 0.15);
    padding: 3.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-soft);
    max-width: 600px;
    width: 100%;
}

.title {
    font-size: 3rem;
    margin-bottom: 0.8rem;
    color: var(--color-text-main);
    font-weight: 400;
    font-style: italic;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    margin-bottom: 3rem;
    font-weight: 300;
}

/* Corporate Sleek Form Styles */
.matrix-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: left;
}

.form-row {
    display: flex;
    gap: 2rem;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

input, select {
    padding: 0.8rem 0;
    border: none;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 0;
    font-family: var(--font-body);
    font-size: 1.1rem;
    background: transparent;
    color: var(--color-text-main);
    transition: var(--transition-fast);
}

input:focus, select:focus {
    outline: none;
    border-bottom: 1px solid var(--color-primary);
    box-shadow: 0 5px 15px -10px var(--color-primary);
}

select option {
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
}

/* Buttons */
.submit-btn {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    padding: 1rem 2rem;
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: var(--transition-fast);
    margin-top: 1.5rem;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    background-color: rgba(212, 175, 55, 0.08);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.outline-btn {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(150,150,150,0.3);
    padding: 0.6rem 1.5rem;
    border-radius: var(--border-radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.outline-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

/* Results Section */
.result-section {
    padding: 4rem 0;
    animation: fadeIn 1s ease;
}

.hidden {
    display: none !important;
}

.result-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.result-header h2 {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.result-header p {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    font-weight: 300;
}

/* Year Toggle */
.year-toggle-wrap {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
}

.year-toggle-wrap label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    font-weight: 400;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
}

.year-toggle-wrap input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: rgba(150,150,150,0.2);
    border-radius: 20px;
    position: relative;
    transition: var(--transition-fast);
    border: 1px solid rgba(212, 175, 55, 0.1);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--color-text-muted);
    border-radius: 50%;
    transition: var(--transition-fast);
}

.year-toggle-wrap input[type="checkbox"]:checked + .toggle-slider {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--color-primary);
}

.year-toggle-wrap input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(20px);
    background: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary);
}

.actions-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.actions-row button {
    margin-top: 0;
}

/* Matrix Visualization */
.export-area {
    transition: background 0.3s ease;
}

.matrix-visualization {
    position: relative;
    max-width: 650px;
    margin: 0 auto 5rem auto;
    background: var(--color-surface);
    border-radius: 50%;
    box-shadow: var(--shadow-soft);
    padding: 2.5rem;
    aspect-ratio: 1 / 1;
    border: 1px solid rgba(212, 175, 55, 0.08);
    backdrop-filter: blur(10px);
}

.svg-container {
    width: 100%;
    height: 100%;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(12, 10, 16, 0.95);
    color: #F3F1ED;
    padding: 1.2rem;
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(212, 175, 55, 0.3);
    pointer-events: none;
    width: 220px;
    z-index: 10;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    transition: opacity 0.2s;
    backdrop-filter: blur(5px);
}

.tooltip h4 {
    color: var(--color-primary);
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
    font-weight: 400;
}

.tooltip p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #b0b0b0;
    font-family: var(--font-body);
}

/* Cards Grid */
.interpretation-panel h3 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2.5rem;
    font-weight: 400;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.info-card {
    background: var(--color-surface);
    padding: 2rem 1.5rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-card);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition-fast);
    border: 1px solid rgba(212, 175, 55, 0.05);
    backdrop-filter: blur(5px);
}

.info-card:hover, .info-card.active {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.03);
}

.card-image {
    width: 65px;
    height: 110px;
    object-fit: cover;
    border-radius: 4px;
    margin: 0 auto 1.2rem auto;
    display: block;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    border: 1px solid rgba(212, 175, 55, 0.4);
    transition: transform var(--transition-slow);
}

.info-card:hover .card-image {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.2);
}

.info-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.info-card p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 300;
}

.info-card .arcana-name {
    font-family: var(--font-heading);
    color: var(--color-primary);
    font-style: italic;
    margin-top: 0.8rem;
    font-weight: 600;
    font-size: 1.05rem;
}

.arcana-value {
    position: absolute;
    top: -15px;
    right: -10px;
    font-size: 4.5rem;
    font-weight: 700;
    color: rgba(212, 175, 55, 0.04);
    font-family: var(--font-heading);
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes drawPath {
    to { stroke-dashoffset: 0; }
}

.svg-path-anim {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawPath 2.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.svg-node-anim {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

/* AI Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: var(--color-surface);
    padding: 3.5rem;
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid rgba(140, 82, 255, 0.3);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: none;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.close-modal:hover {
    color: #8c52ff;
}

.ai-loading {
    text-align: center;
    padding: 4rem 0;
}

.ai-loading .dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: #8c52ff;
    border-radius: 50%;
    margin: 0 5px;
    animation: bounce 1.4s infinite ease-in-out both;
    box-shadow: 0 0 10px #8c52ff;
}

.ai-loading .dot:nth-child(1) { animation-delay: -0.32s; }
.ai-loading .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.ai-response {
    line-height: 1.8;
    color: var(--color-text-main);
    font-size: 1.05rem;
    margin-top: 1.5rem;
    font-weight: 300;
}
.ai-response p {
    margin-bottom: 1.2rem;
}
.ai-response strong {
    color: #8c52ff;
    font-weight: 500;
}

footer {
    text-align: center;
    padding: 3rem 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(212, 175, 55, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 2rem;
    }
    
    .title {
        font-size: 2.2rem;
    }
    
    .glass-panel {
        padding: 2.5rem;
    }
    
    .matrix-visualization {
        padding: 1.5rem;
    }
    
    .actions-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .floating-actions {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}
