:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --sidebar-width: 260px;
}

body {
    background: var(--bg-dark);
    color: #e2e8f0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    min-height: 100vh;
}

.text-muted {
    color: #cbd5e1 !important; /* Gris muy claro, casi blanco, para máxima visibilidad */
}

/* Sidebar Navegación */
.sidebar-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid rgba(255,255,255,0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 2.5rem;
    padding: 0 0.5rem;
}

.brand i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.nav-item.active .nav-link,
.nav-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: white;
}

.nav-item.active .nav-link i {
    color: #667eea;
}

.badge-count {
    margin-left: auto;
    background: rgba(102, 126, 234, 0.2);
    color: #a5b4fc;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    margin-top: auto;
}

/* Main Content Layout */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    max-width: 1600px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}

.content-header h1 {
    font-weight: 700;
    color: white;
    margin: 0.5rem 0;
    font-size: 2rem;
}

.content-header p {
    color: #94a3b8;
    margin: 0;
}

/* Breadcrumb */
.breadcrumb { margin: 0; }
.breadcrumb-item a { color: #667eea; text-decoration: none; font-size: 0.9rem; }
.breadcrumb-item.active { color: #94a3b8; font-size: 0.9rem; }

/* Stats Grid (General & Mixed) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(102, 126, 234, 0.3);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(102, 126, 234, 0.2); color: #a5b4fc; }
.stat-icon.green { background: rgba(16, 185, 129, 0.2); color: var(--success-color); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.2); color: var(--warning-color); }

.stat-details h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
}

.stat-details span {
    font-size: 0.9rem;
    color: #94a3b8;
}

/* Mini Stats (Used in Keyword Detail) */
.stat-card-mini {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
}

.stat-card-mini small {
    font-size: 0.75rem;
    color: #64748b;
}

/* Buttons */
.btn-gradient {
    background: var(--primary-gradient);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    color: white;
}

.btn-outline-light {
    border-color: rgba(255,255,255,0.2);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
}

.btn-outline-light:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

.btn-secondary {
    background: #64748b;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
}

/* Charts */
.card-chart {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

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

.card-header-chart h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header-chart h3 i { color: #667eea; }

/* Table Components */
.card-table {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

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

.card-table-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-custom {
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
    background: transparent !important;
}

.table-custom thead th {
    background: transparent !important;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem;
    border: none;
}

.table-custom tbody tr {
    background: transparent !important;
    transition: all 0.2s ease;
}

.table-custom tbody td {
    background: rgba(255,255,255,0.02) !important;
    padding: 1.25rem 1rem;
    border: none;
    color: #e2e8f0;
    vertical-align: middle;
}

.table-custom tbody tr:hover td {
    background: rgba(255,255,255,0.05) !important;
}

.table-custom tbody td:first-child { border-radius: 12px 0 0 12px; }
.table-custom tbody td:last-child { border-radius: 0 12px 12px 0; }

/* Row Elements */
.id-badge {
    background: rgba(255,255,255,0.05);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-family: monospace;
    color: #94a3b8;
    font-size: 0.9rem;
}

.position-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.pos-top3 { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.pos-top10 { background: rgba(102, 126, 234, 0.2); color: #a5b4fc; border: 1px solid rgba(102, 126, 234, 0.3); }
.pos-rest { background: rgba(255, 255, 255, 0.05); color: #94a3b8; }

.keyword-link {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.keyword-link:hover { color: #a5b4fc; }

.position-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.position-number { font-size: 1.25rem; font-weight: 700; color: white; }

.position-change {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

.position-change.up { color: var(--success-color); }
.position-change.down { color: var(--danger-color); }
.position-change.same { color: #94a3b8; }

.date-cell { display: flex; align-items: center; gap: 10px; color: #94a3b8; }
.date-cell i { font-size: 1.1rem; color: #667eea; }
.date-cell small { color: #64748b; }

.found-url {
    font-size: 0.75rem;
    margin-top: 4px;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-muted-light {
    color: #64748b !important;
    transition: color 0.2s ease;
}

.text-muted-light:hover {
    color: #a5b4fc !important;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.status-badge.verified { background: rgba(16, 185, 129, 0.15); color: var(--success-color); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge.pending { background: rgba(245, 158, 11, 0.15); color: var(--warning-color); border: 1px solid rgba(245, 158, 11, 0.2); }

.url-truncate {
    display: block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #94a3b8;
    background: rgba(255,255,255,0.05);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
}

/* Action Buttons */
.btn-check-single {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: #a5b4fc;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-check-single:hover { background: #667eea; color: white; border-color: #667eea; }

.btn-view {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #e2e8f0;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-view:hover { background: #667eea; color: white; border-color: #667eea; }

/* Exports & Controls */
.btn-export {
    background: rgba(102, 126, 234, 0.15) !important;
    color: #a5b4fc !important;
    border: 1px solid rgba(102, 126, 234, 0.2) !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.8rem !important;
    font-size: 0.85rem !important;
}

/* Animations */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* DataTables & Pagination Custom (Bootstrap 5 Integration) */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info {
    color: #94a3b8 !important;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_filter input {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 10px !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    outline: none !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25) !important;
}

/* Paginación estilo Premium */
.pagination {
    margin-top: 1rem;
    gap: 5px;
}

.page-link {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: #94a3b8 !important;
    border-radius: 8px !important;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.page-item.active .page-link {
    background: var(--primary-gradient) !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.page-link:hover {
    background: rgba(255,255,255,0.1) !important;
    color: white !important;
    border-color: rgba(255,255,255,0.2) !important;
}

.page-item.disabled .page-link {
    background: rgba(255,255,255,0.02) !important;
    border-color: rgba(255,255,255,0.05) !important;
    color: #334155 !important;
}

/* Tfoot Visibility */
tfoot tr td {
    border-top: 1px solid rgba(255,255,255,0.1) !important;
    color: #e2e8f0 !important;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: 1.5rem;
    backdrop-filter: blur(5px);
}

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

.spinner-custom {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
