/* Estilos Premium para wp-casos-exito */

.casos-exito-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Filters Top Bar */
.casos-exito-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
    flex-wrap: wrap;
}

.casos-filter-search {
    flex-grow: 1;
    max-width: 400px;
    position: relative;
    display: flex;
    align-items: center;
}

.casos-filter-search .search-icon {
    position: absolute;
    left: 20px;
    color: #94a3b8;
    pointer-events: none;
}

.casos-filter-search input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    background: #f8fafc;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
    color: #1e293b;
}

.casos-filter-search input:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.casos-filter-search input::placeholder {
    color: #94a3b8;
}

.casos-filter-sort select {
    padding: 14px 40px 14px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    font-size: 16px;
    outline: none;
    background: #f8fafc;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1.5L6 6.5L11 1.5" stroke="%2364748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 18px center;
    transition: all 0.3s ease;
    color: #1e293b;
}

.casos-filter-sort select:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Custom Multi-Select for Categories */
.casos-filter-categories {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.casos-custom-select {
    position: relative;
    max-width: 400px;
    user-select: none;
}

.casos-select-header {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 14px 20px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
    color: #475569;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.casos-select-header:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.casos-select-header.open {
    border-radius: 20px 20px 0 0;
    border-bottom-color: #e2e8f0;
}

.casos-select-header svg {
    transition: transform 0.3s ease;
    stroke: #64748b;
}

.casos-select-header.open svg {
    transform: rotate(180deg);
}

.casos-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    z-index: 99999;
    display: none; /* Toggled by JS */
    max-height: 320px;
    overflow-y: auto;
    padding: 10px 0;
}

/* Force Flex direction on labels so they don't appear inline */
.casos-select-option {
    display: flex !important;
    align-items: flex-start !important;
    padding: 10px 20px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #334155 !important;
    transition: background 0.2s !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.casos-select-option:hover {
    background: #f1f5f9 !important;
}

.casos-select-option input[type="checkbox"] {
    margin-right: 12px !important;
    margin-top: 3px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
}

/* Selected Tags */
.casos-selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.caso-tag-item {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.caso-tag-item span {
    cursor: pointer;
    font-weight: bold;
    color: #64748b;
    font-size: 16px;
    line-height: 1;
    transition: color 0.2s;
}

.caso-tag-item span:hover {
    color: #ef4444;
}

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

/* Loader */
#casos-exito-loader {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f8fafc;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Grid layout */
.casos-exito-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.casos-exito-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Cards */
.caso-exito-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #f1f5f9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.caso-exito-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    border-color: #e2e8f0;
}

.caso-exito-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    font-size: 13px;
    gap: 15px;
}

.caso-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    white-space: normal;
    text-transform: none;
    line-height: 1.4;
    display: inline-block;
}

.caso-date {
    color: #64748b;
    font-weight: 500;
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 5px; /* Align slightly down to match multi-line badges */
}

.caso-exito-title {
    font-size: 18px;
    color: #0f172a;
    line-height: 1.4;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
}

.caso-exito-content {
    font-size: 15px;
    color: #475569;
    line-height: 1.6;
    margin-top: auto;
}

.caso-exito-content p {
    margin-bottom: 12px;
}

.caso-exito-content p:last-child {
    margin-bottom: 0;
}

/* No results */
.casos-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #f8fafc;
    border-radius: 12px;
    color: #64748b;
    font-size: 16px;
    border: 1px dashed #cbd5e1;
}

/* Responsive */
@media (max-width: 768px) {
    .casos-exito-filters {
        flex-direction: column;
        align-items: stretch;
    }
    .casos-filter-search {
        max-width: 100%;
    }
    .casos-exito-grid {
        grid-template-columns: 1fr;
    }
    .casos-custom-select {
        max-width: 100%;
    }
}
