:root {
    --primary: #6b46c1;
    --primary-dark: #553c9a;
    --primary-light: #9f7aea;
    --bg-dark: #1a1a2e;
    --bg-darker: #16213e;
    --bg-card: #0f3460;
    --text: #e8e8e8;
    --text-muted: #a0a0a0;
    --gold: #d4af37;
    --gold-light: #f4d03f;
    --success: #48bb78;
    --error: #f56565;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    color: var(--text);
    min-height: 100vh;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

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

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--primary);
    box-shadow: 0 0 30px rgba(107, 70, 193, 0.3);
    position: relative;
}

.modal-content h2 {
    color: var(--gold);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

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

.close-modal:hover {
    color: var(--text);
}

/* Form */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--primary-dark);
    border-radius: 8px;
    background: var(--bg-darker);
    color: var(--text);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(107, 70, 193, 0.2);
}

.demo-hint {
    margin-top: 1rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    width: 100%;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.4);
}

.btn.secondary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary-light);
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(107, 70, 193, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gold);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.message-balance {
    color: var(--primary-light);
    font-size: 0.9rem;
}

/* Chat Main */
.chat-main {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.welcome-message {
    display: flex;
    gap: 1rem;
    padding: 1rem;
}

.arcana-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--gold) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message {
    padding: 1rem 1.25rem;
    border-radius: 16px;
    max-width: 85%;
}

.message.user {
    background: var(--primary);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background: var(--bg-card);
    border: 1px solid rgba(107, 70, 193, 0.3);
    border-bottom-left-radius: 4px;
}

.message p {
    margin-bottom: 0.5rem;
}

.message p:last-child {
    margin-bottom: 0;
}

.message ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.message li {
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

.message-wrapper {
    display: flex;
    gap: 0.75rem;
}

.message-wrapper.user {
    justify-content: flex-end;
}

.message-wrapper.assistant .arcana-avatar {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
}

/* Cards Display */
.cards-display {
    padding: 1rem;
    background: rgba(15, 52, 96, 0.5);
    border-radius: 16px;
    margin-bottom: 1rem;
}

.cards-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.tarot-card {
    width: 120px;
    text-align: center;
    animation: cardAppear 0.5s ease-out;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.8) rotateY(180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateY(0);
    }
}

.card-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--bg-darker) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 2px solid var(--gold);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-image.reversed {
    transform: rotate(180deg);
    border-color: var(--primary-light);
}

.card-image.reversed .card-name,
.card-image.reversed .card-position {
    transform: rotate(180deg);
}

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

.card-position {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Chat Input */
.chat-input {
    padding: 1rem;
    background: var(--bg-card);
    border-top: 1px solid rgba(107, 70, 193, 0.3);
}

.input-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#message-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--primary-dark);
    border-radius: 24px;
    background: var(--bg-darker);
    color: var(--text);
    font-size: 1rem;
    resize: none;
    max-height: 150px;
    line-height: 1.4;
}

#message-input:focus {
    outline: none;
    border-color: var(--primary);
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn svg {
    width: 24px;
    height: 24px;
}

/* Products */
.products {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.product {
    padding: 1rem;
    border: 1px solid var(--primary-dark);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.product:hover {
    border-color: var(--primary);
    background: rgba(107, 70, 193, 0.1);
}

.product.recommended {
    border-color: var(--gold);
}

.product-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--gold);
    color: var(--bg-dark);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.product-name {
    font-weight: 500;
}

.product-price {
    color: var(--gold);
    font-weight: 600;
}

/* Payment Methods */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.payment-method {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--primary-dark);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-method:hover {
    border-color: var(--primary);
    background: rgba(107, 70, 193, 0.1);
}

.payment-method-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.payment-method-info {
    flex: 1;
    text-align: left;
}

.payment-method-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.payment-method-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.back-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    display: block;
    text-align: left;
}

.back-btn:hover {
    color: var(--text);
}

.selected-product-info {
    background: rgba(107, 70, 193, 0.15);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* SBP Payment Step */
.sbp-instruction {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.sbp-qr-container {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.sbp-qr-container img {
    width: 200px;
    height: 200px;
    display: block;
}

.sbp-timer {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 1rem;
}

#sbp-pay-link {
    display: inline-block;
    text-decoration: none;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Limit reached */
.limit-message {
    text-align: center;
    padding: 1rem;
    background: rgba(245, 101, 101, 0.1);
    border: 1px solid var(--error);
    border-radius: 12px;
    margin: 1rem 0;
}

.limit-message p {
    color: var(--error);
    margin-bottom: 1rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Streaming cursor */
.cursor {
    display: inline-block;
    color: var(--gold);
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.streaming-text {
    white-space: pre-wrap;
}

/* Responsive */
@media (max-width: 600px) {
    .chat-header {
        padding: 0.75rem 1rem;
    }

    .user-info {
        gap: 0.5rem;
    }

    .message-balance {
        display: none;
    }

    .tarot-card {
        width: 90px;
    }

    .card-image {
        height: 135px;
        font-size: 2rem;
    }
}
