/**
 * CSS Buscador de Cédula de Habitabilidad de Cataluña
 * RefCatastral.es - Estilos modernos, responsivos y de alto rendimiento
 */

:root {
    --ced-primary: #1e40af;
    --ced-primary-hover: #1d4ed8;
    --ced-primary-subtle: #eff6ff;
    --ced-green: #059669;
    --ced-green-bg: #ecfdf5;
    --ced-green-border: #a7f3d0;
    --ced-red: #dc2626;
    --ced-red-bg: #fef2f2;
    --ced-red-border: #fecaca;
    --ced-amber: #d97706;
    --ced-amber-bg: #fffbeb;
    --ced-amber-border: #fde68a;
    --ced-blue: #0284c7;
    --ced-blue-bg: #f0f9ff;
    --ced-blue-border: #bae6fd;
    --ced-card-bg: #ffffff;
    --ced-border: #e2e8f0;
    --ced-text-main: #0f172a;
    --ced-text-muted: #64748b;
    --ced-bg-subtle: #f8fafc;
    --ced-radius: 14px;
    --ced-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
}

.cedula-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 1rem 0.75rem 3rem;
    color: var(--ced-text-main);
    font-family: inherit;
}

/* Header */
.cedula-header {
    text-align: center;
    margin-bottom: 1.25rem;
    position: relative;
}

.cedula-badge-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

.cedula-badge-gencat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fdf2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.cedula-badge-gencat svg {
    color: #dc2626;
}

.cedula-badge-official {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--ced-primary-subtle);
    color: var(--ced-primary);
    border: 1px solid #bfdbfe;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}

.cedula-header h1 {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 0.4rem;
    color: var(--ced-text-main);
}

.cedula-header .subtitle {
    font-size: 0.92rem;
    color: var(--ced-text-muted);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.45;
}

/* Language Switcher Bar */
.cedula-lang-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 0.5rem;
}

.lang-toggle-wrap {
    display: inline-flex;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 2px;
    gap: 2px;
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.lang-btn.active {
    background: #ffffff;
    color: var(--ced-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Main Search Card */
.cedula-card {
    background: var(--ced-card-bg);
    border: 1px solid var(--ced-border);
    border-radius: var(--ced-radius);
    box-shadow: 0 2px 12px -2px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

/* Tabs */
.cedula-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid var(--ced-border);
    width: 100%;
    box-sizing: border-box;
}

.cedula-tab-btn {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.5rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-bottom: 2.5px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.tab-label-short {
    display: none;
}

.cedula-tab-btn:hover {
    color: var(--ced-primary);
    background: rgba(239, 246, 255, 0.4);
}

.cedula-tab-btn.active {
    color: var(--ced-primary);
    background: #ffffff;
    border-bottom-color: var(--ced-primary);
}

/* Tab Panels */
.cedula-panel {
    display: none;
    padding: 0.85rem 1.15rem 0.75rem;
}

.cedula-panel.active {
    display: block;
}

.input-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.35rem;
}

.input-label-row label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ced-text-main);
}

.input-label-row .hint {
    font-size: 0.74rem;
    color: var(--ced-text-muted);
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.search-input-wrap {
    flex: 1;
    position: relative;
}

.search-input-wrap input {
    width: 100%;
    padding: 0.55rem 0.85rem 0.55rem 2.25rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    font-family: monospace, monospace;
    text-transform: uppercase;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #ffffff;
    box-sizing: border-box;
}

.search-input-wrap input:focus {
    outline: none;
    border-color: var(--ced-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-input-wrap svg.icon-search {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.btn-search {
    padding: 0.55rem 1.25rem;
    background: var(--ced-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

.btn-search:hover {
    background: var(--ced-primary-hover);
}

.btn-search:active {
    transform: scale(0.98);
}

.btn-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Quick Examples */
.quick-examples {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    font-size: 0.76rem;
    color: var(--ced-text-muted);
}

.example-pill {
    background: #f1f5f9;
    color: #334155;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    font-family: monospace;
    font-weight: 600;
    font-size: 0.75rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
}

.example-pill:hover {
    background: #e2e8f0;
    color: var(--ced-primary);
    border-color: #cbd5e1;
}

/* Loading Spinner */
.cedula-loading {
    display: none;
    text-align: center;
    padding: 1.75rem 1rem;
}

.cedula-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--ced-primary);
    border-radius: 50%;
    animation: cedSpin 0.75s linear infinite;
    margin: 0 auto 0.75rem;
}

@keyframes cedSpin {
    to { transform: rotate(360deg); }
}

/* Alert Boxes */
.cedula-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 0.85rem 1.15rem;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.85rem;
    line-height: 1.45;
}

.cedula-alert-danger {
    background: var(--ced-red-bg);
    border: 1px solid var(--ced-red-border);
    color: #991b1b;
}

.cedula-alert-info {
    background: var(--ced-blue-bg);
    border: 1px solid var(--ced-blue-border);
    color: #0369a1;
}

/* Results Section */
.cedula-results {
    padding: 0 1.15rem 1.15rem;
}

.result-card {
    border: 1px solid var(--ced-border);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.03);
    margin-bottom: 0.65rem;
    overflow: hidden;
}

/* Status Banner */
.status-banner {
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.status-banner.vigente {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46;
}

.status-banner.caducada {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
}

.status-banner.tramite {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #075985;
}

.status-main {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.status-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-banner.vigente .status-icon {
    background: #059669;
    color: #ffffff;
}

.status-banner.caducada .status-icon {
    background: #dc2626;
    color: #ffffff;
}

.status-banner.tramite .status-icon {
    background: #0284c7;
    color: #ffffff;
}

.status-title {
    font-size: 0.96rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}

.status-subtitle {
    font-size: 0.78rem;
    margin: 0.15rem 0 0;
    opacity: 0.9;
}

.status-tag {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(0,0,0,0.08);
}

/* Key Metrics Grid - Compact 4-Columns */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: #fafafa;
    border-bottom: 1px solid var(--ced-border);
}

.metric-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.metric-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--ced-primary-subtle);
    color: var(--ced-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-data .metric-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.metric-data .metric-val {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
    margin-top: 0.1rem;
}

/* Technical Details List */
.tech-details {
    padding: 0.65rem 1rem;
}

.tech-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.tech-row:last-child {
    border-bottom: none;
}

.tech-label {
    color: #64748b;
    font-weight: 600;
    font-size: 0.81rem;
}

.tech-val {
    color: #0f172a;
    font-weight: 700;
    text-align: right;
    font-size: 0.85rem;
}

.tech-val a {
    color: var(--ced-primary);
    text-decoration: none;
}

.tech-val a:hover {
    text-decoration: underline;
}

/* Legal Warning Box inside Result */
.legal-notice-box {
    margin: 0.4rem 1rem 0.75rem;
    padding: 0.45rem 0.8rem;
    border-radius: 7px;
    font-size: 0.8rem;
    line-height: 1.45;
}

.notice-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.notice-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* Building Cluster Table */
.cluster-header {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--ced-border);
}

.cluster-title {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 0.2rem;
}

.cluster-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
}

.cluster-table-wrap {
    overflow-x: auto;
}

.cluster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    text-align: left;
}

.cluster-table th {
    background: #f1f5f9;
    padding: 0.55rem 0.75rem;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #cbd5e1;
    font-size: 0.74rem;
    text-transform: uppercase;
}

.cluster-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.82rem;
}

.cluster-table tr:hover td {
    background: #f8fafc;
}

.pill-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}

.pill-vigente {
    background: #dcfce7;
    color: #15803d;
}

.pill-caducada {
    background: #fee2e2;
    color: #b91c1c;
}

.pill-tramite {
    background: #e0f2fe;
    color: #0369a1;
}

/* Informative Content & Legal Guide */
.cedula-guide-section {
    background: #ffffff;
    border: 1px solid var(--ced-border);
    border-radius: var(--ced-radius);
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    margin-bottom: 2rem;
}

.cedula-guide-section h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--ced-text-main);
    margin: 0 0 1rem;
}

.cedula-guide-section p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: #334155;
    margin-bottom: 1rem;
}

.cedula-highlight-box {
    background: #f8fafc;
    border-left: 4px solid var(--ced-primary);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
}

.cedula-highlight-box h4 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ced-primary);
}

.cedula-highlight-box ul {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
}

/* FAQ Accordion */
.faq-section {
    margin-top: 2rem;
}

.faq-section h3 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: #0f172a;
}

.faq-item {
    border: 1px solid var(--ced-border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: #ffffff;
}

.faq-question {
    width: 100%;
    padding: 1.1rem 1.25rem;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.faq-question:hover {
    background: #f8fafc;
}

.faq-question svg {
    transition: transform 0.2s ease;
    color: #64748b;
    flex-shrink: 0;
}

.faq-item.open .faq-question svg {
    transform: rotate(180deg);
    color: var(--ced-primary);
}

.faq-answer {
    display: none;
    padding: 0 1.25rem 1.25rem;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #475569;
    border-top: 1px solid #f1f5f9;
}

.faq-item.open .faq-answer {
    display: block;
}

/* Responsive */
@media (max-width: 640px) {
    .cedula-header h1 {
        font-size: 1.35rem;
    }
    .cedula-header .subtitle {
        font-size: 0.85rem;
    }
    .tab-label-full {
        display: none;
    }
    .tab-label-short {
        display: inline;
    }
    .cedula-tabs {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
    }
    .cedula-tab-btn {
        min-width: 0;
        padding: 0.55rem 0.2rem;
        font-size: 0.76rem;
        gap: 0.2rem;
        border-bottom-width: 2px;
    }
    .input-label-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }
    .search-input-group {
        flex-direction: column;
    }
    .btn-search {
        width: 100%;
        justify-content: center;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.45rem;
        padding: 0.55rem 0.75rem;
    }
    .status-banner {
        flex-direction: column;
        align-items: flex-start;
    }
    .tech-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }
    .tech-val {
        text-align: left;
    }
}

@media (max-width: 420px) {
    .cedula-tab-btn {
        flex-direction: column;
        gap: 0.15rem;
        padding: 0.45rem 0.1rem;
        font-size: 0.7rem;
    }
    .cedula-tab-btn svg {
        width: 13px;
        height: 13px;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

