:root {
    --primary: #d4af37;
    --accent: #8c52ff;
    --copper: #c87d4a;
    --bg-dark: #0c0a10;
    --text-light: #F3F1ED;
    --starlight: #e8d5b7;
    --glass-bg: rgba(12, 10, 16, 0.75);
    --glass-border: rgba(212, 175, 55, 0.25);
    --deep-purple: #1a0f2e;
    --burgundy: #6b0f1a;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.5); border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.1); }
::-webkit-scrollbar-thumb:hover { background: rgba(212, 175, 55, 0.7); }
* { scrollbar-width: thin; scrollbar-color: var(--primary) rgba(0, 0, 0, 0.1); }

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

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

#bgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Header */
.glass-header {
    text-align: center;
    padding: 15px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    z-index: 10;
}

.glass-header h1 {
    font-size: 1.8rem;
    color: var(--primary);
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    margin-bottom: 5px;
}

.glass-header p {
    font-size: 0.9rem;
    color: var(--starlight);
    opacity: 0.8;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px 100px;
    position: relative;
    z-index: 1;
}

/* Zodiac Grid */
.zodiac-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.zodiac-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.zodiac-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.zodiac-card:hover::before,
.zodiac-card.selected::before {
    opacity: 1;
}

.zodiac-card:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.3);
}

.zodiac-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.zodiac-card .symbol {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
}

.zodiac-card .name {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.zodiac-card .dates {
    font-size: 0.7rem;
    color: var(--starlight);
    opacity: 0.7;
    margin-top: 3px;
}

/* Feature Tabs */
.feature-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.tab-btn {
    padding: 8px 14px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
    font-family: inherit;
}

.tab-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(45deg, rgba(212, 175, 55, 0.3), rgba(140, 82, 255, 0.2));
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

/* Feature Content */
.feature-content {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 25px;
    min-height: 300px;
}

.feature-content h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
}

.feature-content p {
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--starlight);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: var(--bg-dark);
    color: var(--text-light);
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

/* Buttons */
.action-btn {
    padding: 12px 24px;
    background: linear-gradient(45deg, var(--primary), var(--copper));
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.action-btn.secondary {
    background: linear-gradient(45deg, var(--accent), var(--deep-purple));
}

.action-btn.secondary:hover {
    box-shadow: 0 5px 20px rgba(140, 82, 255, 0.4);
}

/* Result Display */
.result-display {
    margin-top: 20px;
    padding: 20px;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    line-height: 1.8;
}

.result-display h4 {
    color: var(--primary);
    margin: 15px 0 8px;
    font-size: 1.1rem;
}

.result-display p {
    margin-bottom: 10px;
}

.result-display .highlight {
    color: var(--primary);
    font-weight: 600;
}

/* Compatibility Score */
.score-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.score-item {
    text-align: center;
    padding: 15px;
    background: rgba(212, 175, 55, 0.08);
    border-radius: 12px;
    min-width: 120px;
}

.score-item .score-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.score-item .score-label {
    font-size: 0.8rem;
    color: var(--starlight);
    margin-top: 5px;
}

/* Lunar Calendar */
.lunar-phases {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    margin: 20px 0;
}

.lunar-phase {
    text-align: center;
    padding: 15px;
    background: rgba(212, 175, 55, 0.05);
    border-radius: 12px;
    min-width: 100px;
}

.lunar-phase .phase-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.lunar-phase .phase-name {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
}

.lunar-phase .phase-date {
    font-size: 0.75rem;
    color: var(--starlight);
    opacity: 0.7;
}

/* Stones Grid */
.stones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stone-card {
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
}

.stone-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
}

.stone-card .stone-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.stone-card .stone-name {
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.stone-card .stone-desc {
    font-size: 0.8rem;
    color: var(--starlight);
    opacity: 0.8;
}

/* Elements Display */
.elements-display {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.element-card {
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s;
}

.element-card:hover {
    transform: scale(1.03);
}

.element-card.fire {
    background: linear-gradient(135deg, rgba(255, 87, 34, 0.2), rgba(255, 152, 0, 0.1));
    border: 1px solid rgba(255, 87, 34, 0.3);
}

.element-card.earth {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(139, 195, 74, 0.1));
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.element-card.air {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2), rgba(100, 181, 246, 0.1));
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.element-card.water {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.2), rgba(186, 104, 200, 0.1));
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.element-card .element-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.element-card .element-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.element-card .element-signs {
    font-size: 0.85rem;
    opacity: 0.8;
}

.element-card .element-traits {
    font-size: 0.8rem;
    margin-top: 8px;
    opacity: 0.7;
}

/* History List */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 12px 15px;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.history-item .history-title {
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 600;
}

.history-item .history-date {
    font-size: 0.75rem;
    color: var(--starlight);
    opacity: 0.6;
    margin-top: 3px;
}

/* Popup */
.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(12, 10, 16, 0.92);
    padding: 30px;
    padding-top: 45px;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.15);
    z-index: 2000;
    color: var(--text-light);
    max-width: 85%;
    width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.popup.show {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.3s;
}

.popup h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
}

.popup .close-popup {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
}

.popup .close-popup:hover {
    color: var(--primary);
    transform: scale(1.2);
}

/* Popup Action Buttons */
.popup-link {
    display: block;
    margin: 10px auto 0;
    padding: 10px 20px;
    background: rgba(194, 112, 62, 0.1);
    color: var(--starlight);
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
    width: fit-content;
    border: 1px solid rgba(194, 112, 62, 0.3);
    font-size: 16px;
    cursor: pointer;
    font-family: inherit;
}

.popup-link:hover {
    transform: scale(1.05);
    background: rgba(194, 112, 62, 0.2);
    box-shadow: 0 0 15px rgba(194, 112, 62, 0.3);
}

.popup .speak-btn.speaking {
    background: linear-gradient(45deg, #ffb84d, #ff704d);
    transform: scale(1.03);
}

.export-pdf-btn {
    background: linear-gradient(45deg, #c2703e, #d4a843) !important;
    color: #fff !important;
}

.export-pdf-btn:hover {
    background: linear-gradient(45deg, #d4a843, #e88d4e) !important;
}

.export-pdf-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.export-text-btn {
    background: linear-gradient(45deg, #6b3410, #8b4513) !important;
    color: #fff !important;
}

.export-text-btn:hover {
    background: linear-gradient(45deg, #8b4513, #c2703e) !important;
}

/* Mic Button (moved to Oráculo tab) */
.mic-btn {
    background: rgba(212, 175, 55, 0.1);
    color: var(--text-light);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    flex-shrink: 0;
}

.mic-btn.listening {
    background: linear-gradient(45deg, #ff4d4d, #6b0f1a);
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(107, 15, 26, 0.4);
}

/* Floating Menu */
.floating-menu {
    position: fixed;
    top: 2px;
    right: 2px;
    left: auto;
    background: rgba(12, 10, 16, 0.6);
    padding: 1px;
    border-radius: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    cursor: move;
    z-index: 1000;
    user-select: none;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    width: 47px;
}

#home-btn, #jogo-btn, #profissionais-btn, #reset-btn, #help-btn, #pwa-btn {
    margin: 0;
    width: 44px;
    padding: 4px 0;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.03);
    color: #F3F1ED;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

#home-btn:hover, #jogo-btn:hover, #profissionais-btn:hover, #reset-btn:hover, #help-btn:hover, #pwa-btn:hover {
    transform: scale(1.1);
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.button-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    align-items: stretch;
    width: 47px;
}

.button-container button {
    position: relative;
}

.tooltip {
    visibility: hidden;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(26, 15, 46, 0.9);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    font-size: 12px;
    pointer-events: none;
}

.button-container button:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(26, 15, 46, 0.9) transparent transparent transparent;
}

/* Slightly smaller button container to match reduced menu */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 0px;
    margin: 0;
    align-items: stretch;
    width: 47px;
}

/* Reduce button padding and font-size inside the floating menu for a more compact look */
.floating-menu .button-container button,
.floating-menu .button-container button span.tooltip {
    font-size: 15px;
}

.floating-menu .button-container button {
    padding: 3px 0;
    height: 36px;
}

.drag-handle {
    cursor: move;
    text-align: center;
    color: var(--primary);
    padding: 6px 0;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 2px;
}

.drag-handle:hover {
    background: rgba(212, 175, 55, 0.15);
    color: var(--text-light);
}

/* Loading Spinner */
.spinner-wrap { text-align: center; padding: 20px; }
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 175, 55, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Alert Modal */
.popup.alert-modal {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    margin: auto;
    max-width: 90%;
}

/* Responsive */
@media (max-width: 768px) {
    .zodiac-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .feature-tabs {
        gap: 5px;
        padding: 8px;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .feature-content {
        padding: 15px;
    }

    .glass-header h1 {
        font-size: 1.4rem;
    }

    .glass-header p {
        font-size: 0.8rem;
    }

    .elements-display {
        grid-template-columns: 1fr;
    }

    .score-container {
        flex-direction: column;
        align-items: center;
    }

    .popup {
        width: 100%;
        max-width: none;
        height: 100%;
        top: 0;
        left: 0;
        transform: none;
        border-radius: 0;
        padding: 20px 10px;
        padding-top: 40px;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .zodiac-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .zodiac-card .symbol {
        font-size: 2rem;
    }

    .zodiac-card .name {
        font-size: 0.75rem;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        min-width: 100%;
    }
}
