/* ============================================================
   PREMIUM CARDS STYLE (Exact Match to Formulario)
   ============================================================ */

/* 1. Grid Configuration: 4 cols desktop */
.section-card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 24px;
    width: 100%;
}
@media (max-width: 1024px) {
    .section-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .section-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .section-card-grid {
        grid-template-columns: 1fr;
    }
}

/* 2. The Card itself (Copied exactly from .checkbox-card) */
.section-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Changed from center to accommodate footer */
    height: 100%;
    position: relative;
    user-select: none;
    outline: none;
}

[data-theme="dark"] .section-card {
    background: #1e293b;
    border-color: #334155;
}

.section-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

[data-theme="dark"] .section-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-color: #475569;
}

/* Active state for card (.checkbox-card.checked) */
.section-card.is-active {
    border-color: #3b82f6;
    background-color: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .section-card.is-active {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

/* 3. Card Inner Elements */
.section-card__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* Icon (.checkbox-card i) */
.section-card__icon {
    color: #64748b;
    font-size: 1.8rem;
    margin-bottom: 10px;
    transition: color 0.2s;
    line-height: 1;
}

.section-card.is-active .section-card__icon {
    color: #3b82f6;
}

/* Title (.checkbox-card span) */
.section-card__title {
    font-weight: 500;
    color: #334155;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

[data-theme="dark"] .section-card__title {
    color: #cbd5e1;
}

.section-card.is-active .section-card__title {
    color: #1e293b;
    font-weight: 600;
}

[data-theme="dark"] .section-card.is-active .section-card__title {
    color: #f8fafc;
}

/* Description (Not in original, keeping minimal) */
.section-card__description {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.3;
    margin-bottom: 12px;
    flex-grow: 1;
}

/* 4. Footer & Stats */
.section-card__footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    gap: 8px;
}

[data-theme="dark"] .section-card__footer {
    border-color: #334155;
}

.section-card__stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}

.section-card__subtotal {
    font-weight: 700;
    font-size: 0.95rem;
    color: #3b82f6;
}

[data-theme="dark"] .section-card__subtotal {
    color: #60a5fa;
}

.section-card__percent {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

/* 5. Status Badge */
.section-card__status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-empty {
    background-color: #f1f5f9;
    color: #64748b;
}

.badge-filled {
    background-color: #dcfce7;
    color: #166534;
}

[data-theme="dark"] .badge-empty {
    background-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .badge-filled {
    background-color: #064e3b;
    color: #34d399;
}

/* ============================================================
   SECTION DETAIL PANEL
   ============================================================ */

.section-detail-panel {
    display: none;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: 4px solid #3b82f6;
    border-radius: 16px;
    padding: 35px;
    grid-column: 1 / -1; /* Ensure panel spans all columns when inserted into grid */
    margin-top: 5px; /* Overlaps slightly with grid gap */
    margin-bottom: 20px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.04);
    position: relative;
    z-index: 10;
    width: 100%;
}

[data-theme="dark"] .section-detail-panel {
    border-color: #334155;
    border-top-color: #60a5fa;
    background: #1e293b;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
}

.section-detail-panel.is-active {
    display: block !important;
    animation: panelFadeIn 0.3s ease-out;
}

.section-detail-panel__title {
    margin-top: 0;
    color: #1e293b;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

[data-theme="dark"] .section-detail-panel__title {
    color: #f8fafc;
}

.section-detail-panel__tip {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
    line-height: 1.5;
}

[data-theme="dark"] .section-detail-panel__tip {
    border-color: #334155;
}

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

/* ============================================================
   INPUT CARDS GRID — Inside section panels
   ============================================================ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 0;
    margin-bottom: 0;
}

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