:root {
    --primary: #1a1a1a;
    --primary-dark: #000000;
    --primary-light: #f5f5f5;
    --success: #333333;
    --warning: #666666;
    --danger: #cc0000;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e0e0e0;
    --gray-300: #cccccc;
    --gray-400: #999999;
    --gray-500: #666666;
    --gray-600: #444444;
    --gray-700: #333333;
    --gray-800: #222222;
    --gray-900: #111111;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.8;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.25rem;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
    font-weight: 600;
}

.card h3 {
    font-size: 1.1rem;
    color: var(--gray-700);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Formularios */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.help-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    font-style: italic;
}

/* Checkboxes */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: var(--gray-100);
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-400);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox-label input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 11px;
    font-weight: bold;
}

/* Textarea e inputs */
textarea, input[type="number"], input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    resize: vertical;
}

textarea:focus, input:focus {
    outline: none;
    border-color: var(--gray-600);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    min-height: 2rem;
}

.tag {
    background: var(--gray-100);
    color: var(--gray-800);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--gray-300);
}

.tag-remove {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
}

.tag-remove:hover {
    color: var(--danger);
}

/* Toggle - CORREGIDO */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--gray-300);
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: var(--shadow-sm);
}

.toggle-label input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-label input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-text {
    font-weight: 500;
    color: var(--gray-700);
}

.filtro-dias-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-left: 3.25rem;
}

.filtro-dias-input input {
    width: 80px;
}

.input-suffix {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* Botones */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* Resultados */
.results-section {
    animation: fadeIn 0.5s ease;
}

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

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

.results-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Tabla */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th {
    background: var(--gray-100);
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.results-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: top;
}

.results-table tr:hover {
    background: var(--gray-50);
}

.results-table tr:last-child td {
    border-bottom: none;
}

/* Badges - Colores neutros */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-activas { background: #e8e8e8; color: #333; }
.badge-publicadas { background: #d0d0d0; color: #333; }
.badge-adjudicadas { background: #b8b8b8; color: #fff; }
.badge-desertas { background: #999; color: #fff; }
.badge-cerradas { background: #666; color: #fff; }
.badge-revocadas { background: #444; color: #fff; }
.badge-suspendidas { background: #222; color: #fff; }

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.pagination button {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.pagination button:hover:not(:disabled) {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
    padding: 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.loading-subtext {
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    padding: 2rem 0;
    font-size: 0.9rem;
}

.footer a {
    color: white;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr 1fr;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Mensajes */
.message {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.message-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message-success {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}

.message-info {
    background: #e8e8e8;
    color: #444;
    border: 1px solid #ccc;
}

/* Búsquedas guardadas */
.saved-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--gray-200);
}

.saved-search-item:hover {
    background: var(--gray-100);
}

.saved-search-info {
    flex: 1;
}

.saved-search-name {
    font-weight: 600;
    color: var(--gray-800);
}

.saved-search-details {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.saved-search-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon-only {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    font-size: 1rem;
}

.btn-icon-only:hover {
    background: var(--gray-200);
}
