/* =============================================================================
   POMAROLI DASHBOARD — Estilos do SPA
   ============================================================================= */

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: #1a2035;
    --bg-card-hover: #1e2642;
    --bg-input: #0d1225;
    --border: #1e293b;
    --border-light: #2a3a5c;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --blue: #3b82f6;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
    --purple: #8b5cf6;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --transition: 0.2s ease;
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#pomaroli-app *,
#pomaroli-app *::before,
#pomaroli-app *::after,
.login-screen *,
.login-screen *::before,
.login-screen *::after,
.app-layout *,
.app-layout *::before,
.app-layout *::after {
    box-sizing: border-box;
}

#pomaroli-app,
.login-screen,
.app-layout {
    font-family: var(--font);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#pomaroli-app a,
.login-screen a,
.app-layout a {
    color: var(--accent);
    text-decoration: none;
}

#pomaroli-app a:hover,
.login-screen a:hover,
.app-layout a:hover {
    color: var(--accent-hover);
}

/* =============================================================================
   LOGIN SCREEN
   ============================================================================= */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(124,58,237,0.2) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59,130,246,0.15) 0px, transparent 50%);
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    text-align: center;
}
.login-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}
.login-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.login-card p { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }

/* =============================================================================
   FORMS
   ============================================================================= */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.form-select { cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-help { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: flex; gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.switch-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text-primary) !important;
}
.form-checkbox { width: auto !important; accent-color: var(--accent); }

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--bg-card-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--amber); border-color: var(--amber); color: #000; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.btn-block { width: 100%; justify-content: center; }

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

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.25s ease, transform 0.25s ease;
    z-index: 100;
}
.sidebar.collapsed {
    width: 68px !important;
}
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-footer span,
.sidebar.collapsed .sidebar-section-title {
    display: none !important;
}
.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 20px 0;
}
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}
.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: 16px 0;
}
.sidebar.collapsed .sidebar-footer button {
    justify-content: center;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}
.brand-text {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-primary);
}
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.nav-item.active {
    background: rgba(124,58,237,0.15);
    color: var(--accent);
    font-weight: 600;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
}

/* MAIN */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
}
.page-title {
    font-size: 18px;
    font-weight: 700;
    flex: 1;
}
.topbar-actions { display: flex; gap: 8px; }
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* =============================================================================
   CARDS
   ============================================================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header h2 i { color: var(--accent); font-size: 16px; }
.card-header-flex { flex-wrap: wrap; gap: 12px; }
.card-body { padding: 20px; }

/* =============================================================================
   STAT CARDS
   ============================================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border-light); }
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-icon.blue { background: rgba(59,130,246,0.15); color: var(--blue); }
.stat-icon.green { background: rgba(16,185,129,0.15); color: var(--green); }
.stat-icon.amber { background: rgba(245,158,11,0.15); color: var(--amber); }
.stat-icon.purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* =============================================================================
   DATA TABLE
   ============================================================================= */
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* =============================================================================
   BADGES & STATUS
   ============================================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-blue { background: rgba(59,130,246,0.15); color: var(--blue); }
.badge-green { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-amber { background: rgba(245,158,11,0.15); color: var(--amber); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.badge-gray { background: rgba(100,116,139,0.15); color: var(--text-muted); }

/* =============================================================================
   PROGRESS BAR
   ============================================================================= */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--blue));
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 2px;
}
.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* =============================================================================
   MODAL
   ============================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    color: var(--text-primary);
}
.modal-lg { max-width: 720px; }
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* =============================================================================
   UPLOAD ZONE
   ============================================================================= */
.upload-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(124,58,237,0.05);
}
.upload-icon { font-size: 48px; color: var(--accent); margin-bottom: 12px; }
.upload-zone h3 { font-size: 16px; margin-bottom: 4px; }
.upload-zone p { font-size: 13px; color: var(--text-muted); }
.upload-file-list {
    margin-top: 16px;
    max-height: 160px;
    overflow-y: auto;
}
.upload-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 13px;
}
.upload-file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-item .file-size { color: var(--text-muted); margin-left: 12px; }

/* =============================================================================
   QUESTIONS GRID
   ============================================================================= */
.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}
.question-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: border-color var(--transition);
}
.question-card:hover { border-color: var(--border-light); }
.question-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.question-card-number {
    font-weight: 700;
    color: var(--accent);
}
.question-card-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.question-card-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.question-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* =============================================================================
   AI REVIEW
   ============================================================================= */
.ai-review-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.ai-stat {
    text-align: center;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
}
.ai-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
}
.ai-stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; }

/* =============================================================================
   ACTIVITY LIST
   ============================================================================= */
.activity-list { max-height: 300px; overflow-y: auto; }
.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}
.activity-dot.info { background: var(--blue); }
.activity-dot.success { background: var(--green); }
.activity-dot.warning { background: var(--amber); }
.activity-dot.error { background: var(--red); }
.activity-time { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* =============================================================================
   SETTINGS
   ============================================================================= */
.settings-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.settings-section:last-of-type { border-bottom: none; }
.settings-section h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}
.settings-section h3 i { color: var(--accent); }

/* =============================================================================
   PAGINATION
   ============================================================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}
.pagination button:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* =============================================================================
   TOASTS
   ============================================================================= */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: toast-in 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 280px;
}
.toast-success { background: rgba(16,185,129,0.95); color: #fff; }
.toast-error { background: rgba(239,68,68,0.95); color: #fff; }
.toast-info { background: rgba(59,130,246,0.95); color: #fff; }
@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* =============================================================================
   MISC
   ============================================================================= */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-24 { margin-bottom: 24px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; display: inline-block; }

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid var(--red); color: #fca5a5; }

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .ai-review-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 200;
    }
    .sidebar.open { transform: translateX(0); }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row-2 { grid-template-columns: 1fr; }
    .questions-grid { grid-template-columns: 1fr; }
}

/* =============================================================================
   CONFIRM MODAL
   ============================================================================= */

.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.confirm-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.25s ease;
}

.confirm-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: var(--red);
}

.confirm-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.confirm-modal-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 24px;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-modal-actions .btn {
    min-width: 120px;
    padding: 10px 20px;
    font-weight: 600;
}

.btn-danger {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* =============================================================================
   JOB FILES EXPAND — Arquivos expandidos na Dashboard
   ============================================================================= */

.job-files-row td {
    padding: 0 !important;
    border-top: none !important;
}

.job-files-expand {
    padding: 8px 16px 12px 16px;
    background: rgba(30, 41, 59, 0.4);
    border-top: 1px solid var(--border);
}

.job-files-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.job-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.5);
    font-size: 13px;
}

.job-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-file-questions {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.btn-toggle-files {
    transition: transform 0.2s ease;
}

.btn-toggle-files i {
    font-size: 11px;
}
