:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #93c5fd;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.tab-btn:hover {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

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

/* Cards */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.cuce {
    font-family: monospace;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    color: #cbd5e1;
}

.score {
    font-weight: bold;
    font-size: 1.1rem;
}

.score.high { color: var(--success); }
.score.mid { color: #fbbf24; }
.score.low { color: var(--danger); }

.entidad {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.objeto {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.btn {
    flex: 1 1 45%;
    min-width: 140px;
    border: none;
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-accept {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-accept:hover {
    background: var(--success);
    color: white;
}

.btn-reject {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-reject:hover {
    background: var(--danger);
    color: white;
}

.btn-info {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-info:hover {
    background: #f59e0b;
    color: white;
}

.btn-download {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

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

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.2rem;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px dashed var(--border);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Card remove animation */
.card.removing {
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
}

/* Badge Coolify */
.badge-coolify {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

/* Extraction Control Panel */
.extraction-panel {
    background: var(--card-bg);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
}

.status-pill {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-idle {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.status-running {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.5);
    animation: pulse 1.8s infinite;
}

.status-completed {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.status-error {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

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

.input-group label {
    display: block;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

#input-cuce {
    flex: 1 1 300px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1.2rem;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

#input-cuce:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.btn-primary-hero {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 0.85rem 1.8rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.help-text {
    display: block;
    margin-top: 0.6rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Console Logs */
.console-wrapper {
    margin-top: 1.5rem;
    background: #020617;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.console-header {
    background: #0f172a;
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-sm {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.console-logs {
    padding: 1.2rem;
    min-height: 250px;
    max-height: 450px;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #4ade80;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Executive Report Grid */
.report-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(12px);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.report-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.report-tag {
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-icon {
    font-size: 1.8rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.stat-total .stat-value { color: #60a5fa; }
.stat-grueso .stat-value { color: #94a3b8; }
.stat-ia .stat-value { color: #f87171; }
.stat-aprobados .stat-value { color: #34d399; }
.stat-dudosos .stat-value { color: #fbbf24; }

/* Navigation Tabs Header */
.tabs-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.badge-reason {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    margin-left: 0.5rem;
}

.reason-grueso {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.reason-ia {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Rejected Horizontal List Layout */
.rejected-list-wrapper {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.rejected-list-header {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.2rem;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    gap: 1rem;
}

.rejected-list-container {
    display: flex;
    flex-direction: column;
}

.rejected-row-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
    gap: 1.2rem;
}

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

.rejected-row-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.col-cuce {
    flex: 0 0 210px;
    white-space: nowrap;
}

.col-cuce .cuce {
    display: inline-block;
    white-space: nowrap;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.col-entidad {
    flex: 0 0 220px;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
}

.col-objeto {
    flex: 1 1 auto;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
}

.col-action {
    flex: 0 0 110px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.btn-sm-action {
    padding: 0.45rem 0.85rem !important;
    font-size: 0.82rem !important;
    min-width: auto !important;
    white-space: nowrap;
    gap: 0.3rem !important;
}

/* Tab Action Bar & Download Buttons */
.tab-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.4);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-subtitle {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
}

.btn-action-download {
    text-decoration: none;
    padding: 0.6rem 1.2rem !important;
    font-size: 0.9rem !important;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

/* Active feedback buttons & new Generar File / Complementarias buttons */
.btn-accept.active {
    background: #059669 !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-reject.active {
    background: #dc2626 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.btn-file {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.btn-file:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.btn-file.generated {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
}

.btn-complementarias {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.btn-complementarias:hover {
    background: rgba(236, 72, 153, 0.3);
    color: #fbcfe8;
}

/* Modal Overlay & Modal Dialog Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.modal-card {
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 20px;
    width: 100%;
    max-width: 820px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: modalSlideUp 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid var(--border);
}

.modal-title-group h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #f8fafc;
}

.badge-cuce {
    font-family: monospace;
    font-size: 0.8rem;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    margin-top: 0.3rem;
    display: inline-block;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-close-modal:hover { color: #f87171; }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.proceso-meta-box {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.2rem;
}

.meta-entidad {
    font-size: 0.88rem;
    color: #94a3b8;
    margin-bottom: 0.3rem;
}

.meta-objeto {
    font-size: 0.98rem;
    color: #f1f5f9;
    font-weight: 500;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
}

.res-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
}

.res-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #818cf8;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.res-val {
    font-size: 0.92rem;
    color: #e2e8f0;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid var(--border);
}
