/* =================================
   DIANA - Sistema TCM-BA
   Layout LIDIA / Cores Marinho+Dourado
   ================================= */

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

* { margin: 0; padding: 0; box-sizing: border-box; }
*, *::before, *::after { transition: all var(--transition); }

:root {
    /* Cores Institucionais TCM-BA */
    --primary: #1e3a5f;
    --primary-dark: #0f2744;
    --primary-light: #2d5f8a;
    --primary-bg: #e8eef5;
    --accent: #c9a961;
    --accent-light: #dcc88a;
    --accent-bg: #faf6ed;

    /* Status */
    --success: #10b981;
    --success-dark: #059669;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Texto */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Fundos */
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);

    /* Design Tokens */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== APP LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0a1628 0%, #1e3a5f 100%);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 24px 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    width: 72px;
    height: 72px;
    border-radius: 0;
    object-fit: contain;
    background: none;
    padding: 0;
}

.sidebar-brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.sidebar-brand p {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    padding: 12px 14px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.65);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-item.active {
    background: rgba(201,169,97,0.2);
    color: white;
    font-weight: 600;
    border-left: 3px solid var(--accent);
    padding-left: 11px;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.nav-label {
    flex: 1;
}

.nav-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}

.nav-item.active .nav-badge {
    background: rgba(201,169,97,0.3);
    color: var(--accent-light);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.diana-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(201,169,97,0.3);
    background: rgba(201,169,97,0.1);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
}

.diana-chat-btn:hover {
    background: rgba(201,169,97,0.2);
}

.diana-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.diana-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.diana-avatar-small::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--primary-dark);
}

.diana-chat-info {
    flex: 1;
    text-align: left;
}

.diana-chat-info strong {
    display: block;
    font-size: 0.82rem;
}

.diana-chat-info span {
    font-size: 0.7rem;
    opacity: 0.6;
}

.sidebar-version {
    text-align: center;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.25);
    padding: 8px 0 4px;
}

/* ===== MAIN AREA ===== */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-height);
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 40%, #ffd4d4 100%);
    border-bottom: 2px solid #f0b8b8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.menu-toggle:hover {
    background: var(--bg-body);
}

.topbar-title h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.law-tag {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 2px 10px;
    border-radius: 10px;
    margin-left: 10px;
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-dot.offline {
    background: var(--error);
    animation: none;
}

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

.topbar-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--accent-bg);
    border: 1px solid var(--accent);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
}

/* ===== CONTENT AREA ===== */
.content {
    flex: 1;
    padding: 28px;
}

/* ===== VIEWS ===== */
.welcome-view, .module-view {
    display: none;
    animation: fadeSlideIn 0.3s ease;
}

.welcome-view.active, .module-view.active {
    display: block;
}

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

/* ===== WELCOME VIEW ===== */
.welcome-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 28px;
}

.welcome-hero h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.welcome-hero p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.welcome-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.stat-icon.navy { background: var(--primary-bg); color: var(--primary); }
.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #ecfdf5; color: #10b981; }
.stat-icon.amber { background: #fffbeb; color: #f59e0b; }
.stat-icon.gold { background: var(--accent-bg); color: var(--accent); }

.stat-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.welcome-hint {
    background: var(--accent-bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.welcome-hint i {
    color: var(--accent);
    font-size: 1.2rem;
    margin-top: 2px;
}

/* ===== MODULE VIEW ===== */
.module-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.module-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.module-header h3 i {
    margin-right: 8px;
}

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

/* ===== UPLOAD ZONE ===== */
.upload-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-body);
}

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

.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.upload-icon-large {
    font-size: 2.5rem;
    color: var(--primary-light);
    margin-bottom: 12px;
}

.upload-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-specs {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-specs span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.upload-specs i {
    color: var(--success);
}

/* ===== SELECTED FILE CARD ===== */
.selected-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.file-icon {
    font-size: 2rem;
    color: var(--error);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.file-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.btn-remove:hover {
    background: #fef2f2;
    color: var(--error);
}

/* ===== PAGE SELECTOR ===== */
.page-selector-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.page-selector-container label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.page-input-modern {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
}

.page-input-modern:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

/* ===== MUNICIPIO SELECTOR ===== */
.municipio-selector-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.municipio-selector-container label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.municipio-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background-color: white;
    cursor: pointer;
    color: var(--text-primary);
}

.municipio-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(30,58,95,0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(30,58,95,0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(16,185,129,0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-body);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn.loading .spinner {
    display: block;
}

.btn.loading .btn-text {
    display: none;
}

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

/* Action Bar */
.action-bar {
    margin-bottom: 24px;
}

.action-bar .btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
}

/* ===== PROGRESS SECTION ===== */
.progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    animation: fadeSlideIn 0.3s ease;
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.progress-icon-wrapper {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--info), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.progress-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.progress-track {
    height: 10px;
    background: var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.progress-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.step {
    text-align: center;
    padding: 14px 10px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
}

.step.active {
    background: var(--primary-bg);
    border-color: var(--primary-light);
}

.step.completed {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.step-icon {
    font-size: 1.3rem;
    margin-bottom: 6px;
}

.step-text {
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== LOADING OVERLAY ===== */
.analysis-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
}

.analysis-loading.show {
    display: flex;
}

.loading-spinner-large {
    width: 56px;
    height: 56px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 280px;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-muted);
    background: var(--bg-body);
}

.loading-step.active {
    color: var(--primary);
    background: var(--primary-bg);
    font-weight: 600;
}

.loading-step.done {
    color: var(--success);
    background: #ecfdf5;
}

.loading-step i {
    width: 20px;
    text-align: center;
}

/* ===== NOTIFICATIONS ===== */
.notification {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 300;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    transform: translateX(420px);
    opacity: 0;
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
.notification.error { background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%); }
.notification.warning { background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%); }
.notification.info { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); }

/* ===== CHAT OVERLAY ===== */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.chat-overlay.active {
    display: flex;
}

.chat-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    animation: chatSlideIn 0.3s ease;
}

@keyframes chatSlideIn {
    from { transform: translateY(30px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.chat-header-text h3 {
    font-size: 1.05rem;
    margin-bottom: 2px;
}

.chat-header-text p {
    font-size: 0.8rem;
    opacity: 0.8;
}

.chat-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.chat-close:hover {
    background: rgba(255,255,255,0.25);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-body);
    min-height: 300px;
    max-height: 400px;
}

.message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    max-width: 80%;
    line-height: 1.6;
    font-size: 0.9rem;
}

.message.diana {
    background: white;
    border: 1px solid var(--border);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message.user {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.typing-indicator {
    display: none;
    padding: 12px 16px;
}

.typing-indicator.active {
    display: block;
}

.typing-dots {
    display: flex;
    gap: 6px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

.chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.chat-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
    color: var(--primary);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

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

.modal-body {
    padding: 24px;
}

.resolucao-card {
    background: var(--bg-body);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border-left: 4px solid var(--accent);
}

.resolucao-card h4 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 10px;
}

.resolucao-card ul {
    margin-left: 20px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.resolucao-card li {
    margin-bottom: 4px;
}

.info-importante {
    background: var(--primary-bg);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 12px;
    border-left: 4px solid var(--info);
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.info-importante i {
    font-size: 1.3rem;
    color: var(--info);
    margin-top: 2px;
}

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== SOBRE VIEW ===== */
.sobre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.sobre-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.sobre-card-destaque {
    grid-column: 1 / -1;
    border: 2px solid var(--accent);
    background: linear-gradient(135deg, var(--accent-bg) 0%, #ffffff 100%);
}

.sobre-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 14px;
}

.sobre-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.sobre-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.sobre-list {
    list-style: none;
    padding: 0;
}

.sobre-list li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sobre-list li::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.6rem;
    color: var(--accent);
}

.sobre-list li:last-child {
    border-bottom: none;
}

.sobre-alerta {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef3c7;
    border-radius: var(--radius-md);
    border-left: 4px solid #d97706;
    display: flex;
    gap: 10px;
    font-size: 0.84rem;
    color: #92400e;
    align-items: center;
}

.sobre-alerta i {
    font-size: 1rem;
    color: #d97706;
}

/* ===== DOWNLOAD BUTTONS ===== */
.download-btn {
    flex: 1;
    min-width: 100px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.download-btn:hover {
    background: rgba(255,255,255,0.3);
}

.download-notification {
    max-width: 450px !important;
}

/* ===== LOADING ICON ON BUTTON ===== */
.btn.loading .btn-icon-fa {
    display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 16px;
    }

    .welcome-stats {
        grid-template-columns: 1fr;
    }

    .progress-steps {
        grid-template-columns: 1fr;
    }

    .topbar-badge {
        display: none;
    }

    .law-tag {
        display: none;
    }

    .topbar {
        padding: 0 16px;
    }
}
