@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-navy: #0f172a;
    --navy-light: #1e293b;
    --accent-gold: #b59d70;
    --gold-hover: #a38b5f;
    --gold-soft: rgba(181, 157, 112, 0.1);
    --bg-slate: #f8fafc;
    --text-main: #334155;
    --text-muted: #64748b;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.8);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 12px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-slate);
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Navbar */
.navbar {
    background: var(--primary-navy) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
}

.ls-wide {
    letter-spacing: 0.1em;
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-header {
    background: var(--white) !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 1.25rem 1.5rem !important;
}

/* Buttons */
.btn-primary {
    background: var(--primary-navy);
    border: none;
    font-weight: 600;
    border-radius: 10px;
    padding: 0.8rem 1.8rem;
    transition: var(--transition);
}

.btn-primary:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4) !important;
}

/* Tree View */
.tree-container {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.tree-node {
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    color: #475569;
}

.tree-node i {
    font-size: 1.1rem;
    margin-right: 12px;
    color: var(--text-muted);
}

.tree-node:hover {
    background: var(--bg-slate);
    color: var(--primary-navy);
}

.tree-node.active {
    background: var(--gold-soft);
    color: var(--accent-gold);
}

.tree-node.active i {
    color: var(--accent-gold);
}

.tree-children {
    margin-left: 20px;
    padding-left: 12px;
    border-left: 1px solid #f1f5f9;
    display: none;
}

.tree-children.show {
    display: block;
}

/* Forms */
.form-control {
    border-radius: 8px;
    transition: var(--transition);
}

.form-control:focus {
    box-shadow: 0 0 0 4px var(--gold-soft);
    border-color: var(--accent-gold);
}

/* Historial */
#historial {
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

.historial-item {
    padding: 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    transition: var(--transition);
}

.historial-item:hover {
    background: var(--bg-slate);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.4s ease-out;
}

/* Chatbot Floating Widget */
#chatbot-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

#chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 480px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: chatOpen 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatOpen {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#chat-body {
    scrollbar-width: thin;
    scrollbar-color: #f1f5f9 transparent;
}

.chat-msg {
    margin-bottom: 1rem;
    display: flex;
}

.chat-msg.user {
    justify-content: flex-end;
}

.chat-msg.user .msg-content {
    background: var(--primary-navy);
    color: #fff;
    border-radius: 12px 12px 0 12px;
}

.chat-msg.bot .msg-content {
    background: var(--bg-slate);
    color: var(--text-main);
    border-radius: 12px 12px 12px 0;
}

.msg-content {
    padding: 10px 14px;
    max-width: 85%;
    font-size: 0.85rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.text-gold {
    color: var(--accent-gold);
}

#chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2) !important;
}

/* OCR Progress Indicator */
.ocr-progress-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    min-width: 400px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.ocr-progress-container .card {
    border-width: 2px;
}

.ocr-progress-container .progress {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) inset;
}

.ocr-progress-container .progress-bar {
    font-weight: 600;
    font-size: 14px;
    line-height: 25px;
    transition: width 0.3s ease;
}

.progress-message {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
}

.progress-details {
    display: block;
    font-size: 13px;
}

@media (max-width: 576px) {
    .ocr-progress-container {
        min-width: 90%;
        max-width: 90%;
    }
}

/* Animations */
.pulse-animation {
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}