:root {
    --bg-dark: #09090b;
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --accent: #3b82f6; /* Changed to Blue */
    --accent-glow: rgba(59, 130, 246, 0.4); /* Changed to Blue */
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.06);
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 4rem 2rem;
    overflow-x: hidden;
    position: relative;
}

/* Stunning Animated Gradient Background Effects */
.background-effects {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    width: 45vw;
    height: 45vw;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: float 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.orb-1 {
    top: -15%; left: -10%;
    background: #3b82f6; /* Blue Glow */
}

.orb-2 {
    bottom: -20%; right: -15%;
    background: #60a5fa; /* Lighter Blue transition */
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(15%, 15%) scale(1.1); }
}

.container {
    width: 100%;
    max-width: 800px;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3.5rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3.8rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: 0.5rem;
}

/* Text Gradient for Logo Effect */
.highlight {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-muted);
    font-size: 1.25rem;
    font-weight: 300;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.8s ease-out;
}

.config-panel h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-weight: 300;
}

.filter-group {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    user-select: none;
    gap: 12px;
}

.checkbox-container input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent);
}

.state-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.state-active { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.state-closed { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.state-eval { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.state-other { background: rgba(161, 161, 170, 0.2); color: #a1a1aa; }

/* Layout para los campos principales de búsqueda */
.search-main-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: flex-end;
}

.nit-group {
    flex: 1;
}

.keywords-group {
    flex: 2; /* Toma más espacio según lo pedido */
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-group input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 1.1rem 1.2rem;
    border-radius: 14px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: rgba(0, 0, 0, 0.4);
}

/* Estilo Destacado para 'Servicios Ofrecidos' */
.hero-group label {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    font-weight: 700;
}

.hero-group input {
    border-color: rgba(59, 130, 246, 0.3) !important;
    background: rgba(59, 130, 246, 0.08) !important;
    font-size: 1.15rem !important;
    padding: 1.25rem 1.5rem !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.hero-group input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 25px var(--accent-glow) !important;
    background: rgba(59, 130, 246, 0.12) !important;
    transform: translateY(-2px);
}

/* Responsive para dispositivos móviles */
@media (max-width: 768px) {
    .search-main-row {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }
}

.actions {
    margin-top: 2.5rem;
}

.btn-primary {
    width: 100%;
    padding: 1.2rem;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #2563eb); /* Modern Blue */
    color: white;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 20px -10px var(--accent);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -10px var(--accent);
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

/* Spinner for loading state */
.loader {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Results section styling */
.results-panel {
    margin-top: 3.5rem;
    animation: fadeInUp 0.5s ease-out;
}

.results-panel h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.result-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 1.8rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Tarjeta Expirada (Rojo Quemado / Desvaído) */
.result-card.expired {
    background: rgba(153, 27, 27, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    opacity: 0.85;
    filter: saturate(0.8);
}

.result-card.expired:hover {
    transform: none;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

.result-card.expired .match-score {
    background: linear-gradient(135deg, #7f1d1d, #450a0a) !important;
    color: #fca5a5 !important;
    box-shadow: none !important;
}

.result-card.expired .entidad {
    color: #a1a1aa;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.2rem;
}

.entidad {
    font-weight: 600;
    color: #e4e4e7;
    font-size: 1.1rem;
    padding-right: 15px;
}

.procedimiento-nombre {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 2px;
}

.reference-code {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.5px;
}

/* The Fake LLM Score */
.match-score {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 0.5rem 0.9rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
    white-space: nowrap;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.filter-subgroup {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 150px;
}

.filter-subgroup label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.filter-subgroup input[type="number"],
.filter-subgroup input[type="date"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.filter-subgroup input:focus,
.filter-subgroup select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.custom-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    appearance: none; /* Hide default arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    cursor: pointer;
}

.custom-select option {
    background: var(--bg-dark);
    color: white;
}

.filter-subgroup input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.secop-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    margin: 1.2rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.detail-item {
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
}

.detail-item strong {
    color: #cbd5e1;
    font-weight: 500;
}

.detail-item span {
    color: #f4f4f5;
    font-weight: 600;
}

.date-red { color: #ef4444 !important; text-shadow: 0 0 8px rgba(239, 68, 68, 0.4); animation: pulseDanger 2s infinite alternate; }
.date-orange { color: #f97316 !important; text-shadow: 0 0 8px rgba(249, 115, 22, 0.4); }
.date-green { color: #10b981 !important; text-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }
.date-gray { color: #52525b !important; }

@keyframes pulseDanger {
    from { color: #ef4444; }
    to { color: #fca5a5; }
}

.descripcion {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2; /* Compatibilidad */
}

.header-main {
    display: flex;
    align-items: center;
    gap: 15px;
}

.contract-type-icon {
    font-size: 1.8rem;
    background: rgba(255, 255, 255, 0.05);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 0.8fr;
    gap: 10px;
}

.btn-action, .btn-link {
    padding: 0.8rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.btn-telegram {
    background: rgba(0, 136, 204, 0.1);
    color: #0088cc;
    border: 1px solid rgba(0, 136, 204, 0.3);
}

.btn-telegram:hover {
    background: #0088cc;
    color: white;
}

.btn-pdf {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-pdf:hover {
    background: #ef4444;
    color: white;
}

.btn-link {
    background: rgba(255, 255, 255, 0.05);
    color: #e4e4e7;
    border: 1px solid var(--glass-border);
}

.btn-link:hover {
    background: var(--glass-border);
    border-color: var(--accent);
}

.btn-telegram.sent {
    background: var(--success);
    color: white;
    border-color: transparent;
}

/* Micro Animations keyframes */
/* Modal and Icons */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    width: 100%;
    padding-right: 3.5rem;
}

.icon-btn {
    position: absolute;
    right: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-muted);
    padding: 0.6rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: all 0.3s;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlide 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: white;
}

.modal-header {
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.6rem;
    color: var(--accent);
}

.modal-info {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.8rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#modalBody {
    color: #f4f4f5;
}

.badge-status {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    width: fit-content;
}

#pymeBadge {
    font-size: 1.8rem;
    vertical-align: middle;
    margin-left: 10px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
    animation: pulseGold 2s infinite alternate;
}

@keyframes pulseGold {
    from { filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.4)); transform: scale(1); }
    to { filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8)); transform: scale(1.1); }
}

.pyme-badge-card {
    font-size: 1.2rem;
    margin-left: 8px;
    vertical-align: middle;
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.4));
}

.verified-label {
    color: #1d9bf0; /* Twitter Blue */
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
}

.blue-check {
    background: #1d9bf0;
    color: white;
    font-size: 0.65rem;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}
