/* =====================================================
   EPSA UI Enhancement System
   Shared CSS for consistent UX/UI across all sections
   ===================================================== */

/* ========== BREADCRUMB ========== */
.ca-breadcrumb {
    background: #fff;
    border-radius: 8px;
    padding: 10px 16px;
    border: 1px solid #e9ecef;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ca-breadcrumb a {
    color: #3b82f6;
    font-weight: 500;
    text-decoration: none;
    font-size: 13px;
}

.ca-breadcrumb a:hover {
    text-decoration: underline;
}

.ca-breadcrumb .ca-sep {
    color: #cbd5e1;
    font-size: 10px;
}

.ca-breadcrumb .ca-active {
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

/* Edit/New mode badge */
.ca-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    margin-left: 8px;
}

.ca-mode-edit {
    background: #fef3c7;
    color: #92400e;
}

.ca-mode-new {
    background: #d1fae5;
    color: #065f46;
}

/* ========== SECTION BLOCKS ========== */
.ca-section {
    margin-bottom: 1.25rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    border: 1px solid #e9ecef;
    transition: box-shadow .2s;
}

.ca-section:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

.ca-section .block {
    margin-bottom: 0;
    border: none;
    box-shadow: none;
}

.ca-section .block-header {
    border-bottom: 1px solid #e9ecef;
}

/* Section color variants - forms */
.ca-section-contacto {
    border-left: 4px solid #3b82f6;
}

.ca-section-fiscal {
    border-left: 4px solid #8b5cf6;
}

.ca-section-ubicacion {
    border-left: 4px solid #10b981;
}

.ca-section-config {
    border-left: 4px solid #f59e0b;
}

.ca-section-adjuntos {
    border-left: 4px solid #6366f1;
}

/* Section color variants - generic */
.ca-section-primary {
    border-left: 4px solid #3b82f6;
}

.ca-section-info {
    border-left: 4px solid #06b6d4;
}

.ca-section-success {
    border-left: 4px solid #10b981;
}

.ca-section-warning {
    border-left: 4px solid #f59e0b;
}

.ca-section-danger {
    border-left: 4px solid #ef4444;
}

.ca-section-purple {
    border-left: 4px solid #8b5cf6;
}

.ca-section-indigo {
    border-left: 4px solid #6366f1;
}

/* Section header icons */
.ca-section .block-title .ca-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    margin-right: 8px;
    font-size: 14px;
    color: #fff;
}

.ca-section-contacto .ca-icon {
    background: #3b82f6;
}

.ca-section-fiscal .ca-icon {
    background: #8b5cf6;
}

.ca-section-ubicacion .ca-icon {
    background: #10b981;
}

.ca-section-config .ca-icon {
    background: #f59e0b;
}

.ca-section-adjuntos .ca-icon {
    background: #6366f1;
}

.ca-section-primary .ca-icon {
    background: #3b82f6;
}

.ca-section-info .ca-icon {
    background: #06b6d4;
}

.ca-section-success .ca-icon {
    background: #10b981;
}

.ca-section-warning .ca-icon {
    background: #f59e0b;
}

.ca-section-danger .ca-icon {
    background: #ef4444;
}

.ca-section-purple .ca-icon {
    background: #8b5cf6;
}

.ca-section-indigo .ca-icon {
    background: #6366f1;
}

/* Subtitle badge */
.ca-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ========== INFO ALERT ========== */
.ca-info-alert {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #1e40af;
}

.ca-info-alert i {
    font-size: 18px;
    color: #3b82f6;
    flex-shrink: 0;
}

/* ========== FORM ENHANCEMENTS ========== */
.contentzillo .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

.contentzillo .form-control[readonly] {
    background-color: #f8fafc;
    color: #94a3b8;
    font-style: italic;
}

.contentzillo label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 4px;
}

.contentzillo select.form-control {
    cursor: pointer;
}

/* ========== FIELD DIVIDERS ========== */
.ca-field-divider {
    border-top: 1px dashed #e2e8f0;
    margin: 8px 0 16px;
    padding-top: 8px;
}

.ca-field-divider-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
    font-weight: 600;
}

/* ========== SUBMIT AREA ========== */
.ca-submit-area {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 0 0 8px 8px;
    margin: 0 -20px -20px;
}

.ca-submit-btn {
    padding: 10px 40px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: .3px;
    box-shadow: 0 2px 4px rgba(59, 130, 246, .3);
    transition: all .2s;
}

.ca-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, .35);
}

.ca-submit-btn i {
    margin-right: 6px;
}

/* Progress bar wrapper */
.ca-progress-wrap {
    max-width: 400px;
    margin: 0 auto 15px;
}

/* ========== FILE UPLOAD AREA ========== */
.ca-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: border-color .2s;
    background: #fafbfc;
    cursor: pointer;
}

.ca-upload-area:hover,
.ca-upload-area:focus-within {
    border-color: #3b82f6;
    background: #eff6ff;
}

.ca-upload-area input[type="file"] {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.ca-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #64748b;
    font-size: 13px;
}

.ca-upload-label i {
    font-size: 24px;
    color: #94a3b8;
}

.ca-upload-label span {
    font-weight: 600;
    color: #3b82f6;
}

/* ========== ENHANCED LIST VIEW ========== */
.ca-section .table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #475569;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    padding: 10px 12px;
}

.ca-section .badge {
    font-size: 11px;
}

/* Stats badges in list header */
.ca-stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    margin-left: 4px;
}

/* ========== DASHBOARD ========== */
.ca-dashboard-welcome {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 24px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.ca-dashboard-welcome h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #fff;
}

.ca-dashboard-welcome p {
    margin: 4px 0 0;
    opacity: .85;
    font-size: 14px;
}

.ca-dashboard-welcome .ca-welcome-icon {
    font-size: 48px;
    opacity: .3;
}

.ca-dashboard-heading {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

/* Dashboard cards */
.ca-dash-card {
    border-radius: 10px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    border: 1px solid rgba(0, 0, 0, .06);
    margin-bottom: 16px;
}

.ca-dash-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.ca-dash-card .block-content {
    border-radius: 10px;
}

.ca-dash-card .ca-dash-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 12px;
}

.ca-dash-card .ca-dash-count {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.ca-dash-card .ca-dash-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    opacity: .8;
}

/* Dashboard card color variants */
.ca-dash-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

.ca-dash-blue .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.ca-dash-green .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
}

.ca-dash-purple .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-amber {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.ca-dash-amber .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-cyan {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
}

.ca-dash-cyan .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.ca-dash-red .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-indigo {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
}

.ca-dash-indigo .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-teal {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
}

.ca-dash-teal .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-rose {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
}

.ca-dash-rose .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-slate {
    background: linear-gradient(135deg, #64748b, #475569);
    color: #fff;
}

.ca-dash-slate .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.ca-dash-emerald {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #fff;
}

.ca-dash-emerald .ca-dash-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

/* Map container */
.mapzillo {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .ca-submit-btn {
        width: 100%;
    }

    .ca-breadcrumb {
        padding: 8px 12px;
    }

    .ca-dashboard-welcome {
        padding: 20px;
    }

    .ca-dashboard-welcome h2 {
        font-size: 18px;
    }
}

/* ═══════════════════════════════════════════
   COTIZACIONES – Status Pills & Filter Bar
   ═══════════════════════════════════════════ */

/* ── Status Pills ── */
.ca-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    transition: all .2s;
    text-decoration: none !important;
    cursor: default;
}

.ca-status-pill i {
    font-size: 10px;
}

.ca-status-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.ca-status-accepted {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.ca-status-active {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.ca-status-service {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

/* Clickable status pills (for quick status change) */
.ca-status-pill[data-id_c] {
    cursor: pointer;
}

.ca-status-pill[data-id_c]:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}

/* ── Filter Bar ── */
.ca-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.ca-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    text-decoration: none !important;
    transition: all .2s;
    border: 1px solid #e2e8f0;
}

.ca-filter-pill:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.ca-filter-active {
    background: #3b82f6 !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

.ca-filter-active.ca-filter-pending {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
}

.ca-filter-active.ca-filter-accepted {
    background: #10b981 !important;
    border-color: #10b981 !important;
}

.ca-filter-active.ca-filter-active-status {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

/* ── Stats Row ── */
.ca-stats-row {
    margin-bottom: 1rem;
}

.ca-stats-row .ca-dash-card {
    margin-bottom: 8px;
}

.ca-stats-row .ca-dash-card .block-content {
    padding: 12px 8px;
}

.ca-stats-row .ca-dash-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
    margin-bottom: 8px;
}

.ca-stats-row .ca-dash-count {
    font-size: 22px;
}

.ca-stats-row .ca-dash-label {
    font-size: 10px;
}

/* ═══════════════════════════════════════════
   COTIZACIONES – Table Cells
   ═══════════════════════════════════════════ */

.ca-folio-link {
    font-weight: 700;
    color: #3b82f6;
    font-size: 14px;
    text-decoration: none;
}

.ca-folio-link:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

.ca-cliente-cell a {
    font-size: 13px;
    color: #475569;
    display: block;
    line-height: 1.5;
}

.ca-cliente-cell a:hover {
    color: #3b82f6;
}

.ca-concepto-cell {
    font-size: 12px;
    color: #64748b;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ca-fecha-cell {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

.ca-total-cell {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
}

.ca-actions-cell {
    white-space: nowrap;
}

.ca-action-group {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.ca-btn-action {
    border-radius: 6px;
    transition: all .15s;
}

.ca-btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

/* ── New Cotización button ── */
.ca-btn-new {
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 2px 4px rgba(59, 130, 246, .25);
}

.ca-btn-new:hover {
    box-shadow: 0 4px 8px rgba(59, 130, 246, .35);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════
   COTIZACIONES – Form (Alta/Editar)
   ═══════════════════════════════════════════ */

/* ── Conceptos Table ── */
.ca-conceptos-table {
    margin-bottom: 0;
}

.ca-conceptos-table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 8px 6px;
    text-align: center;
}

.ca-conceptos-table thead th:first-child {
    text-align: center;
}

.ca-concept-row td {
    vertical-align: middle;
    padding: 6px 4px;
}

.ca-drag-handle {
    cursor: grab;
    color: #94a3b8;
    text-align: center;
    font-size: 14px;
    padding: 8px 2px !important;
    width: 32px;
}

.ca-drag-handle:active {
    cursor: grabbing;
}

.ca-drag-handle:hover {
    color: #3b82f6;
}

.ca-input-sm {
    font-size: 13px;
    padding: 5px 8px;
    text-align: center;
}

.ca-input-desc {
    font-size: 13px;
    padding: 5px 8px;
}

.ca-input-importe {
    background-color: #f8fafc !important;
    color: #1e293b;
    font-weight: 600;
    cursor: default;
}

.ca-btn-delete-concept {
    border-radius: 50%;
    width: 28px;
    height: 28px;
    padding: 0;
    line-height: 26px;
    opacity: .6;
    transition: all .15s;
}

.ca-btn-delete-concept:hover {
    opacity: 1;
    background: #fee2e2;
    border-color: #fecaca;
}

/* ── Totals Card ── */
.ca-totals-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 12px;
}

.ca-total-item {
    text-align: center;
}

.ca-total-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.ca-total-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #334155;
}

.ca-total-highlight .ca-total-value {
    color: #3b82f6;
    font-size: 24px;
}

/* ── Sortable placeholder ── */
.sortable-conceptos .ui-sortable-helper {
    display: table-row !important;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    border: 2px solid #3b82f6;
}

.sortable-conceptos .ui-sortable-placeholder,
.ca-sortable-placeholder {
    visibility: visible !important;
    display: table-row !important;
}

/* ── Upload Area Enhancement ── */
.ca-upload-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* ═══════════════════════════════════════════
   COTIZACIONES – Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
    .ca-stats-row .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .ca-action-group {
        flex-wrap: wrap;
    }

    .ca-totals-card .row>div {
        margin-bottom: 8px;
    }

    .ca-total-value {
        font-size: 16px;
    }

    .ca-total-highlight .ca-total-value {
        font-size: 18px;
    }

    .ca-filter-bar {
        gap: 4px;
    }

    .ca-filter-pill {
        padding: 4px 10px;
        font-size: 11px;
    }
}