/* Licitaciones Novagentia - Dark Theme */
:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-card-hover: #222633;
    --bg-input: #252833;
    --border: #2a2e3a;
    --border-light: #363b4a;
    --text: #e4e6eb;
    --text-muted: #8b90a0;
    --text-dim: #5c6070;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #10b981;
    --red: #ef4444;
    --yellow: #f59e0b;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.nav-logo {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
}

.nav-title {
    font-size: 18px;
    font-weight: 600;
}

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

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg-input);
}

.nav-link.active {
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

/* Main */
main.container {
    padding-top: 24px;
    padding-bottom: 40px;
}

/* Page header */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

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

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Table */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tr:hover td {
    background: var(--bg-card-hover);
}

.td-title {
    max-width: 400px;
}

.td-title a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.td-title a:hover {
    color: var(--accent);
}

.td-title .td-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.td-amount {
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.td-date {
    white-space: nowrap;
    font-size: 13px;
}

.td-nowrap {
    white-space: nowrap;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.badge-sm {
    padding: 2px 8px;
    font-size: 11px;
}

.badge-pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Filters bar */
.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input, .filter-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.filter-input:focus, .filter-select:focus {
    border-color: var(--accent);
}

.filter-input {
    min-width: 220px;
}

.filter-select {
    min-width: 140px;
    cursor: pointer;
}

.filter-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.filter-btn:hover {
    background: var(--accent-hover);
}

.filter-clear {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.filter-clear:hover {
    color: var(--text);
    border-color: var(--border-light);
    background: var(--bg-input);
}

/* Detail page */
.detail-header {
    margin-bottom: 24px;
}

.detail-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.detail-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    color: var(--text-muted);
    font-size: 14px;
}

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.detail-section {
    margin-bottom: 20px;
}

.detail-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
}

.info-value.large {
    font-size: 20px;
    font-weight: 700;
}

/* Analisis block */
.analisis-block {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 14px;
    white-space: pre-wrap;
    line-height: 1.7;
    max-height: 500px;
    overflow-y: auto;
}

/* Timeline */
.timeline {
    list-style: none;
}

.timeline li {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

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

.timeline-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.timeline-text {
    flex: 1;
}

.timeline-date {
    color: var(--text-dim);
    font-size: 12px;
    white-space: nowrap;
}

/* Documents list */
.doc-list {
    list-style: none;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

.doc-item a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.doc-item a:hover {
    text-decoration: underline;
}

.doc-icon {
    width: 32px;
    height: 32px;
    background: var(--bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.doc-meta {
    color: var(--text-dim);
    font-size: 12px;
}

/* Bid progress */
.bid-progress {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.sobre-card {
    flex: 1;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
}

.sobre-card.ready {
    border: 1px solid var(--green);
}

.sobre-card .sobre-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.sobre-card .sobre-status {
    font-size: 20px;
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
}

.back-link:hover {
    color: var(--text);
}

/* Links */
a.external-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
}

a.external-link:hover {
    text-decoration: underline;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 14px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 16px 0;
    margin-top: 40px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-input, .filter-select {
        width: 100%;
        min-width: unset;
    }

    .nav-title {
        display: none;
    }

    table {
        font-size: 13px;
    }

    td, th {
        padding: 8px;
    }

    .td-title {
        max-width: 200px;
    }

    .bid-progress {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-value {
        font-size: 24px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
