@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Montserrat:wght@600&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
    /* Colors */
    --background: #15130c;
    --surface: #1a1a2e; /* Navy dark */
    --surface-light: #222018;
    --primary: #c5a059; /* Gold */
    --primary-bright: #e9c176;
    --on-surface: #e8e2d6; /* Parchment */
    --error: #ffb4ab;
    --success: #66bb6a;
    
    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    --font-label: 'Montserrat', sans-serif;
    
    /* Spacing & Sizes */
    --container-max: 1200px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    background-color: var(--background);
    color: var(--on-surface);
    font-family: var(--font-body);
    line-height: 1.6;
    background-image: radial-gradient(circle at top, #222018 0%, #15130c 100%);
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-bright);
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s;
}
a:hover { color: var(--primary-bright); }

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 2rem;
}

header {
    padding: 1rem 2rem;
}

/* Glassmorphism Panels */
.glass-panel {
    background: rgba(26, 26, 46, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(197, 160, 89, 0.2);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Buttons */
.btn {
    font-family: var(--font-label);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: #15130c;
}
.btn-primary:hover {
    background-color: var(--primary-bright);
    box-shadow: 0 4px 15px rgba(233, 193, 118, 0.4);
}

@keyframes pulseGlow {
    0% { opacity: 0.7; box-shadow: 0 0 5px var(--primary); text-shadow: 0 0 5px var(--primary); }
    50% { opacity: 1; box-shadow: 0 0 15px var(--primary-bright); text-shadow: 0 0 10px var(--primary-bright); }
    100% { opacity: 0.7; box-shadow: 0 0 5px var(--primary); text-shadow: 0 0 5px var(--primary); }
}

.btn.thinking {
    animation: pulseGlow 1.5s infinite;
    pointer-events: none;
    color: var(--primary-bright) !important;
}
.btn-primary.thinking {
    color: var(--background) !important;
    text-shadow: none !important;
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-ghost:hover {
    background: rgba(197, 160, 89, 0.1);
    box-shadow: 0 0 10px rgba(197, 160, 89, 0.2);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-family: var(--font-label);
    font-size: 0.875rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

input[type="text"], input[type="password"], input[type="email"], textarea {
    width: 100%;
    background: rgba(21, 19, 12, 0.5);
    border: none;
    border-bottom: 1px solid var(--primary);
    color: var(--on-surface);
    padding: 0.75rem;
    font-family: var(--font-body);
    transition: border-color 0.3s;
}

input:focus, textarea:focus {
    outline: none;
    border-bottom-color: var(--primary-bright);
    background: rgba(21, 19, 12, 0.8);
}

/* Utils */
.text-center { text-align: center; }
.hidden { display: none !important; }

/* Dashboard Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.dashboard-card:hover {
    transform: translateY(-5px);
}

/* Tarot Deck & Layout */
.tarot-table {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    margin-top: 2rem;
}

.deck-container {
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
}
.deck-container:hover {
    transform: scale(1.02);
}
.deck-container::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: var(--radius-md);
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.15);
    z-index: -1;
}

.drawn-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    min-height: 200px;
}

.drawn-cards:empty {
    min-height: 0;
    display: none;
}

.tarot-card {
    width: 150px;
    height: 250px;
    border: 1px solid rgba(197, 160, 89, 0.4);
    border-radius: var(--radius-md);
    background-color: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    background-size: cover;
    background-position: center;
    position: relative;
    transition: transform 0.3s ease;
}

.tarot-card.back {
    background-image: url('assets/cards/reverso.jpg');
    background-color: #37352c;
}

.tarot-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(197, 160, 89, 0.2);
}

.tarot-card.inverted {
    transform: rotate(180deg);
}

.tarot-card.inverted:hover {
    transform: translateY(-10px) rotate(180deg);
    box-shadow: 0 -10px 20px rgba(197, 160, 89, 0.2);
}

.card-link {
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.card-link:hover {
    color: var(--primary-bright);
}

/* Chat Messages */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    max-width: 85%;
}

/* Markdown typography inside messages & conclusion */
.message p, .collapsible-text p {
    margin-bottom: 1.2rem;
}
.message p:last-child, .collapsible-text p:last-child {
    margin-bottom: 0;
}
.message ul, .message ol, .collapsible-text ul, .collapsible-text ol {
    margin-bottom: 1.2rem;
    padding-left: 1.5rem;
}
.message li, .collapsible-text li {
    margin-bottom: 0.5rem;
}

.message.ia {
    background: rgba(26, 26, 46, 0.9);
    border-left: 2px solid var(--primary);
    align-self: flex-start;
}

.message.tarotista {
    background: rgba(197, 160, 89, 0.1);
    border-right: 2px solid var(--primary);
    align-self: flex-end;
}

.message.sistema {
    align-self: center;
    font-size: 0.85rem;
    opacity: 0.6;
    text-align: center;
}

/* Collapsible text */
.collapsible-text {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.collapsible-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    .glass-panel {
        padding: 1rem;
    }
    .message {
        max-width: 95%;
        padding: 0.75rem 1rem;
    }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    header {
        padding: 1rem 0.5rem;
        flex-wrap: wrap;
        gap: 1rem;
    }
    #nav-actions {
        justify-content: center !important;
    }
    #nav-actions button {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
}