/* =============================================
   FluvIA — AGILIZA-ESE Brand Design System
   Colors, typography, and layout matching
   https://agiliza-ese.com/fluvia/
   ============================================= */

:root {
    --primary: #1863DC;
    --primary-dark: #0056A7;
    --primary-light: #e8f0fc;
    --primary-lighter: #f0f5ff;
    --bg: #F4F4F4;
    --bg-dark: #1a1f2e;
    --card: #FFFFFF;
    --text: #212121;
    --text-light: #FFFFFF;
    --text-muted: #858585;
    --text-secondary: rgba(0,0,0,0.65);
    --border: #e2e5e9;
    --border-light: #D0D5D2;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --radius: 4px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.1);
    --max-width: 1240px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

.hidden { display: none !important; }

/* =============================================
   TOP BAR
   ============================================= */
.top-bar {
    background: var(--bg-dark);
    color: rgba(255,255,255,0.8);
    font-size: 0.75rem;
    padding: 6px 0;
    letter-spacing: 0.3px;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar i { margin-right: 6px; color: var(--primary); }

.top-bar-right a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: color var(--transition);
}

.top-bar-right a:hover { color: #fff; }

/* =============================================
   HEADER
   ============================================= */
header {
    background: #FFFFFF;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-agiliza {
    height: 40px;
    width: auto;
}

.logo-divider {
    width: 1px;
    height: 32px;
    background: var(--border-light);
}

.logo-fluvia {
    height: 36px;
    width: auto;
}

.main-nav {
    display: flex;
    gap: 4px;
}

.main-nav a {
    padding: 8px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.main-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.main-nav a.nav-active {
    background: var(--primary);
    color: white;
}

/* =============================================
   HERO
   ============================================= */
.hero {
    background: linear-gradient(135deg, #0a1628 0%, #1a2d50 40%, #1863DC 100%);
    color: white;
    padding: 64px 0 72px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: radial-gradient(circle at 70% 50%, rgba(24,99,220,0.3), transparent 70%);
}

.hero-content {
    position: relative;
    max-width: 680px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.text-primary { color: #5ba3ff; }

.hero-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 12px;
    line-height: 1.5;
}

.hero-description {
    font-size: 0.9rem;
    opacity: 0.7;
    line-height: 1.7;
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    gap: 12px;
}

/* =============================================
   SECTION TABS
   ============================================= */
.section-tabs {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 72px;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.section-tabs .container {
    display: flex;
    gap: 0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}

.tab-btn:hover {
    color: var(--primary);
    background: var(--primary-lighter);
}

.tab-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.tab-btn i { font-size: 1rem; }

/* =============================================
   MAIN CONTENT
   ============================================= */
main { padding: 0 0 48px; }

.content-section {
    display: none;
    padding-top: 32px;
}

.content-section.active { display: block; }

.section-header {
    margin-bottom: 28px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.section-header h2 i {
    color: var(--primary);
    margin-right: 8px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* =============================================
   CARDS
   ============================================= */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
    transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
    padding: 14px 20px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    background: var(--primary-lighter);
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header i { color: var(--primary); }

.card-body { padding: 20px; }

/* Integration Card */
.card-integration {
    border-left: 4px solid var(--warning);
}

.card-integration .card-header {
    background: var(--warning-bg);
    border-bottom-color: var(--warning);
}

.card-integration .card-header i { color: var(--warning); }

.integration-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--warning-bg);
    border: 1px solid rgba(245,158,11,0.3);
    color: #92400e;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.integration-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
    margin-top: 8px;
    font-weight: 500;
}

.integration-link:hover { text-decoration: underline; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn:hover { background: var(--bg); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-lg { padding: 12px 28px; font-size: 0.9rem; }
.btn-full { width: 100%; }

/* =============================================
   UPLOAD ZONE
   ============================================= */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    text-align: center;
    margin-bottom: 14px;
    transition: all var(--transition);
    background: var(--bg);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-lighter);
}

.upload-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
    opacity: 0.6;
}

.upload-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.upload-filename {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.4;
}

.empty-state p { font-size: 0.85rem; }

/* =============================================
   CHAT
   ============================================= */
.card-chat { min-height: 480px; display: flex; flex-direction: column; }
.card-chat .card-body { flex: 1; display: flex; flex-direction: column; }

.chat-body { display: flex; flex-direction: column; }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: auto;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
    padding: 8px 0;
    margin-bottom: 14px;
}

.message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.message-bot .message-avatar {
    background: var(--primary-light);
    color: var(--primary);
}

.message-user .message-avatar {
    background: var(--primary);
    color: white;
}

.message-content {
    background: var(--bg);
    padding: 12px 16px;
    border-radius: 2px var(--radius-lg) var(--radius-lg) var(--radius-lg);
    max-width: 85%;
}

.message-user .message-content {
    background: var(--primary);
    color: white;
    border-radius: var(--radius-lg) 2px var(--radius-lg) var(--radius-lg);
    margin-left: auto;
}

.message-user { flex-direction: row-reverse; }

.message-content p { font-size: 0.9rem; line-height: 1.6; }

.quick-questions { margin-top: 14px; }

.quick-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.quick-btn {
    display: inline-block;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.78rem;
    color: var(--primary);
    cursor: pointer;
    margin: 3px 3px 3px 0;
    font-family: var(--font);
    transition: all var(--transition);
}

.quick-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.chat-input {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.chat-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color var(--transition);
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24,99,220,0.1);
}

/* =============================================
   FORMS
   ============================================= */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.form-group { margin-bottom: 0; }

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.form-group label i {
    color: var(--primary);
    margin-right: 4px;
    width: 14px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
    background: white;
    transition: all var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24,99,220,0.1);
}

.formula-ref {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--primary-lighter);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--primary);
}

/* =============================================
   FICHA SELECTOR
   ============================================= */
.ficha-grid { display: flex; flex-direction: column; gap: 8px; }

.ficha-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
}

.ficha-option:hover:not(.disabled) {
    border-color: var(--primary);
    background: var(--primary-lighter);
}

.ficha-option.active {
    border-color: var(--primary);
    background: var(--primary-lighter);
    box-shadow: 0 0 0 2px rgba(24,99,220,0.15);
}

.ficha-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ficha-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.ficha-info { flex: 1; }
.ficha-info strong { display: block; font-size: 0.85rem; }
.ficha-info span { font-size: 0.78rem; color: var(--text-muted); }

.ficha-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.ficha-badge.available { background: var(--success-bg); color: #166534; }
.ficha-badge.coming { background: var(--bg); color: var(--text-muted); }

/* =============================================
   CALCULATION RESULT
   ============================================= */
.result-header { background: var(--success-bg) !important; border-bottom-color: var(--success) !important; }
.result-header i { color: var(--success) !important; }

.result-big {
    text-align: center;
    padding: 24px;
}

.result-big .result-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.result-big .result-unit {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.result-item {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
}

.result-item .result-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.result-item .result-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.result-formula {
    margin-top: 16px;
    padding: 12px;
    background: var(--primary-lighter);
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: monospace;
    word-break: break-all;
}

/* =============================================
   DOCUMENT CHECKLIST
   ============================================= */
.doc-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.doc-item:last-child { border-bottom: none; }

.doc-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.doc-icon.missing { background: #fef2f2; color: var(--danger); }
.doc-icon.uploaded { background: var(--success-bg); color: var(--success); }

.doc-info strong { font-size: 0.85rem; display: block; }
.doc-info span { font-size: 0.78rem; color: var(--text-muted); }

.doc-progress {
    margin-top: 14px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
}

.doc-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.doc-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* =============================================
   BILL DATA TABLE
   ============================================= */
.bill-data table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.bill-data th, .bill-data td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.bill-data th {
    font-weight: 600;
    background: var(--primary-lighter);
    color: var(--text);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bill-data .estimated { color: var(--warning); }
.bill-data .total-row { font-weight: 700; background: var(--success-bg); }

.bill-data h4 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =============================================
   FOOTER
   ============================================= */
footer {
    background: var(--bg-dark);
    color: rgba(255,255,255,0.7);
    padding: 48px 0 0;
    margin-top: 48px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-logo {
    height: 36px;
    filter: brightness(0) invert(1);
    margin-bottom: 12px;
}

.footer-tagline {
    font-size: 0.82rem;
    line-height: 1.6;
    opacity: 0.7;
}

.footer-col h4 {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-col a {
    display: block;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.82rem;
    padding: 3px 0;
    transition: color var(--transition);
}

.footer-col a:hover { color: white; }

.social-links {
    display: flex;
    gap: 10px;
}

.social-links a {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.social-links a:hover {
    background: var(--primary);
    color: white;
}

.footer-bottom {
    text-align: center;
    padding: 18px 0;
    font-size: 0.75rem;
    opacity: 0.5;
}

/* =============================================
   LOADING
   ============================================= */
.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-left: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 921px) {
    .grid-2 { grid-template-columns: 1fr; }
    .header-inner { height: auto; flex-direction: column; gap: 12px; padding: 12px; }
    .main-nav { gap: 0; }
    .hero h1 { font-size: 2.5rem; }
    .hero-actions { flex-direction: column; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
    .form-row { grid-template-columns: 1fr; }
    .result-details { grid-template-columns: 1fr; }
}

@media (max-width: 544px) {
    .hero { padding: 40px 0 48px; }
    .hero h1 { font-size: 2rem; }
    .logo { flex-direction: column; gap: 8px; }
    .logo-divider { display: none; }
    .tab-btn span { display: none; }
    .footer-grid { grid-template-columns: 1fr; }
}
