/* ==========================================================================
   CADIA PRESETS & SYSTEM DESIGN (VANILLA CSS)
   ========================================================================== */

:root {
    /* Colores principales */
    --brand-color: #b10e2b;
    --brand-color-hover: #8c0b22;
    --brand-color-alpha: rgba(177, 14, 43, 0.08);
    --brand-color-alpha-heavy: rgba(177, 14, 43, 0.15);

    /* Fondos */
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-header: #ffffff;

    /* Textos */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-on-brand: #ffffff;

    /* Bordes e Interfaces */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Categorías de Complejidad */
    --badge-low-bg: #ecfdf5;
    --badge-low-text: #059669;
    --badge-medium-bg: #fffbeb;
    --badge-medium-text: #d97706;
    --badge-high-bg: #fef2f2;
    --badge-high-text: #dc2626;

    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
    --shadow-glow: 0 0 20px rgba(177, 14, 43, 0.12);

    /* Bordes Redondeados */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-full: 9999px;

    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset de Estilos */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ==========================================================================
   ELEGANT HEADER BRANDING
   ========================================================================== */

.main-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.logo span {
    color: var(--brand-color);
}

.brand .divider {
    width: 1px;
    height: 32px;
    background-color: var(--border-color);
}

.app-title-container h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.app-title-container .subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f1f5f9;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    position: relative;
}

.status-indicator.animate-pulse::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #10b981;
    border-radius: 50%;
    animation: pulse-ring 1.8s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

.status-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}

@keyframes pulse-ring {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

/* ==========================================================================
   APP CONTAINER & PANELS GRID
   ========================================================================== */

.app-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 2rem;
    align-items: start;
    min-height: calc(100vh - 180px);
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
}

.card-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background-color: var(--brand-color-alpha);
    color: var(--brand-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.5rem;
}

.instruction-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ==========================================================================
   COLUMNA IZQUIERDA
   ========================================================================== */

.textarea-wrapper {
    position: relative;
    width: 100%;
}

textarea {
    width: 100%;
    height: 120px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    padding-right: 2.2rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    resize: none;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea:focus {
    border-color: var(--brand-color);
    box-shadow: var(--shadow-glow);
}

.clear-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 2px 5px;
    border-radius: 4px;
    display: none;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.clear-btn:hover {
    color: var(--brand-color);
    background-color: var(--brand-color-alpha);
}

.helper-container {
    margin-top: 0.65rem;
    text-align: right;
}

.btn-text-link {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-text-link:hover {
    color: var(--brand-color);
    background-color: var(--brand-color-alpha);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    background-color: var(--brand-color);
    color: var(--text-on-brand);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.85rem 1.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(177, 14, 43, 0.2);
    transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    margin-top: 1rem;
}

.btn-primary:hover {
    background-color: var(--brand-color-hover);
    box-shadow: 0 6px 14px rgba(177, 14, 43, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.margin-value-display {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.85rem;
}

.margin-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.margin-percentage {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--brand-color);
    line-height: 1;
}

.slider-container {
    margin-bottom: 1rem;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background: #e2e8f0;
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand-color);
    border: 3px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.1s ease, background 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--brand-color-hover);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.formula-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    background-color: #f1f5f9;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.formula-info i {
    color: var(--brand-color);
}

/* ==========================================================================
   COLUMNA DERECHA
   ========================================================================== */

.panel-right {
    min-height: 500px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 400px;
    padding: 3rem;
}

.welcome-content {
    max-width: 450px;
}

.welcome-icon {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    background-color: var(--brand-color-alpha);
    color: var(--brand-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.welcome-screen h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.welcome-screen p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.loading-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 400px;
    text-align: center;
    animation: fadeIn var(--transition-normal);
}

.scanner-container {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 20px;
    background-color: #f1f5f9;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.scanner-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
}

.scanner-line {
    position: absolute;
    width: 100%;
    height: 4px;
    background: linear-gradient(to bottom, rgba(177, 14, 43, 0), var(--brand-color), rgba(177, 14, 43, 0));
    box-shadow: 0 0 10px var(--brand-color);
    top: 0;
    left: 0;
    animation: scan 1.5s ease-in-out infinite;
}

@keyframes scan {
    0% { top: 0%; }
    50% { top: 95%; }
    100% { top: 0%; }
}

.loading-screen h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.loading-screen p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.loading-bar-wrapper {
    width: 220px;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background-color: var(--brand-color);
    border-radius: var(--radius-full);
    animation: loading-fill 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes loading-fill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ==========================================================================
   MÉTRICAS CLAVE
   ========================================================================== */

.budget-result {
    animation: fadeIn var(--transition-slow);
}

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

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-app);
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: box-shadow var(--transition-fast);
}

.metric-card:hover {
    box-shadow: var(--shadow-sm);
}

.metric-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.metric-badge {
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    display: inline-block;
}

.metric-badge-baja { background-color: var(--badge-low-bg); color: var(--badge-low-text); }
.metric-badge-media { background-color: var(--badge-medium-bg); color: var(--badge-medium-text); }
.metric-badge-alta { background-color: var(--badge-high-bg); color: var(--badge-high-text); }

.metric-footer {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-card-highlighted {
    background: linear-gradient(135deg, var(--brand-color), #8c0b22);
    border-color: var(--brand-color);
    box-shadow: 0 4px 12px rgba(177, 14, 43, 0.15);
}

.metric-card-highlighted .metric-title { color: rgba(255, 255, 255, 0.75); }
.metric-card-highlighted .metric-value { color: #ffffff; font-size: 1.7rem; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.metric-card-highlighted .metric-footer { color: rgba(255, 255, 255, 0.85); font-weight: 600; }

/* ==========================================================================
   DESPIECE & TABLAS DE COSTES
   ========================================================================== */

.budget-details-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

.panel-section-title {
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.panel-section-title h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-section-title h3 i { color: var(--brand-color); }

.escandallo-category-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}

.category-trigger {
    width: 100%;
    padding: 0.85rem 1.25rem;
    background-color: #f8fafc;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: inherit;
    transition: background-color var(--transition-fast);
}

.category-trigger:hover { background-color: #f1f5f9; }

.category-trigger-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
}

.category-trigger-title i { width: 16px; color: var(--text-muted); }

.category-trigger-total {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cat-total-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.cat-total-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.category-content-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.category-content-table th {
    background-color: #ffffff;
    color: var(--text-muted);
    font-weight: 700;
    text-align: left;
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.category-content-table td {
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
}

.category-content-table tr:last-child td { border-bottom: none; }
.category-content-table .col-right { text-align: right; }
.category-content-table .col-center { text-align: center; }

/* ==========================================================================
   GRÁFICO CIRCULAR SVG
   ========================================================================== */

.chart-panel {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin: 1rem 0;
}

.donut-chart-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
}

.donut-chart { transform: rotate(-90deg); }

.donut-segment {
    transition: stroke-dasharray var(--transition-slow), stroke-dashoffset var(--transition-slow);
}

.donut-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.donut-total-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.donut-total-lbl {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chart-legend {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background-color: #ffffff;
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.6rem;
    flex-shrink: 0;
}

.legend-label { flex-grow: 1; }

.legend-pct {
    color: var(--text-muted);
    font-weight: 700;
    margin-left: 0.5rem;
}

.actions-panel { margin-top: 1.25rem; }

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background-color: #ffffff;
    color: var(--brand-color);
    border: 1.5px solid var(--brand-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background-color: var(--brand-color);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(177, 14, 43, 0.1);
}

.btn-secondary:active { transform: scale(0.98); }

/* ==========================================================================
   MODAL DE PROPUESTA COMERCIAL
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: opacity var(--transition-normal);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-box {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalSlideUp var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { transform: translateY(30px) scale(0.96); }
    to { transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.modal-title h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close-btn:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.modal-body { padding: 1.5rem; }

.modal-intro {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.print-preview-card {
    background-color: #ffffff;
    border: 2px solid var(--text-main);
    padding: 2.25rem;
    font-family: inherit;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.preview-brand .p-brand {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--text-main);
}

.preview-brand .p-brand span { color: var(--brand-color); }

.preview-brand .p-tagline {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
}

.preview-doc-info { text-align: right; }

.p-doc-title {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--brand-color);
    letter-spacing: 0.05em;
}

.p-doc-id {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.1rem;
}

.p-doc-date {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

.preview-divider {
    height: 1px;
    background-color: var(--text-main);
    margin: 1.25rem 0;
}

.preview-section { margin-bottom: 1.25rem; }

.preview-section h4 {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.preview-desc-text {
    font-size: 0.88rem;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.4;
}

.preview-grid-2 {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1rem;
    align-items: end;
}

.preview-specs-list { list-style: none; }

.preview-specs-list li {
    font-size: 0.78rem;
    color: var(--text-main);
    margin-bottom: 0.35rem;
    display: flex;
    gap: 0.35rem;
}

.preview-specs-list li strong {
    font-weight: 600;
    color: var(--text-muted);
}

.align-right-box {
    display: flex;
    justify-content: flex-end;
}

.price-box-wrapper {
    background-color: #f8fafc;
    border: 1px solid var(--text-main);
    padding: 0.85rem 1.25rem;
    text-align: center;
    border-radius: var(--radius-sm);
}

.price-box-lbl {
    display: block;
    font-size: 0.58rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.price-box-val {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--brand-color);
}

.price-box-taxes {
    display: block;
    font-size: 0.55rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.15rem;
}

.preview-footer-note {
    font-size: 0.58rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-outline {
    background: none;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-outline:hover {
    border-color: var(--brand-color);
    color: var(--brand-color);
    background-color: var(--brand-color-alpha);
}

/* ==========================================================================
   TOAST DE NOTIFICACIÓN
   ========================================================================== */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background-color: #1e293b;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 1100;
    transition: opacity 0.2s, transform 0.2s;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(15px);
    pointer-events: none;
}

.toast-icon { color: #10b981; font-size: 1rem; }
.toast-message { font-size: 0.85rem; font-weight: 600; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

.hidden { display: none !important; }

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        padding: 0 1.5rem;
        margin: 1.5rem auto;
    }
    .panel-left { max-width: 100%; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .budget-details-grid { grid-template-columns: 1fr; }
    .chart-panel { order: -1; }
}

@media (max-width: 640px) {
    .main-header { padding: 1rem; }
    .brand { gap: 0.75rem; }
    .logo { font-size: 1.4rem; }
    .brand .divider { height: 24px; }
    .app-title-container h1 { font-size: 0.95rem; }
    .header-status { display: none; }
    .metrics-grid { grid-template-columns: 1fr; }
    .modal-box { max-width: 100%; border-radius: var(--radius-md); }
    .print-preview-card { padding: 1.25rem; }
    .preview-grid-2 { grid-template-columns: 1fr; gap: 1.25rem; }
    .align-right-box { justify-content: center; }
    .price-box-wrapper { width: 100%; }
    .modal-actions { flex-direction: column; }
    .modal-actions button { width: 100%; }
    .action-buttons-group { flex-direction: column; gap: 0.75rem; }
    .btn-blueprint { width: 100%; }
}

/* ==========================================================================
   IMPRESIÓN
   ========================================================================== */

@media print {
    body * { visibility: hidden; }
    #print-proposal-content, #print-proposal-content * { visibility: visible; }
    #print-proposal-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
    .price-box-wrapper {
        border: 2px solid #000000 !important;
        background-color: #f8fafc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==========================================================================
   LOGO Y BOTONES IA
   ========================================================================== */

.brand-logo-img {
    height: 36px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
    transition: transform var(--transition-normal);
}

.brand-logo-img:hover { transform: rotate(5deg) scale(1.05); }

.action-buttons-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
}

.action-buttons-group .btn-primary {
    margin-top: 0;
    flex: 1.1;
}

.btn-blueprint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 0.9;
    background-color: #ffffff;
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-blueprint:hover {
    border-color: var(--brand-color);
    color: var(--brand-color);
    background-color: var(--brand-color-alpha);
    box-shadow: var(--shadow-sm);
}

.btn-blueprint:active { transform: scale(0.98); }

/* ==========================================================================
   MODAL DE PLANO
   ========================================================================== */

.blueprint-upload-area {
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    background-color: #f8fafc;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.blueprint-upload-area:hover {
    border-color: var(--brand-color);
    background-color: var(--brand-color-alpha);
}

.blueprint-upload-area .upload-icon {
    font-size: 2.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.blueprint-upload-area:hover .upload-icon {
    color: var(--brand-color);
    transform: translateY(-4px);
}

.blueprint-upload-area h3 { font-size: 1rem; font-weight: 700; color: var(--text-main); }
.blueprint-upload-area p { font-size: 0.82rem; color: var(--text-muted); }

.blueprint-upload-area .file-limits {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.5rem;
}

.blueprint-processing-status {
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    animation: fadeIn var(--transition-normal);
}

.spinner-brand {
    width: 45px;
    height: 45px;
    border: 4px solid var(--border-color);
    border-top-color: var(--brand-color);
    border-radius: 50%;
    margin: 0 auto 1.25rem auto;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.blueprint-processing-status h4 { font-size: 1.05rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.25rem; }
.blueprint-processing-status p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.blueprint-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.blueprint-progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--brand-color);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    box-shadow: 0 0 8px var(--brand-color);
}

/* ==========================================================================
   FOOTER CORPORATIVO
   ========================================================================== */

.app-footer {
    max-width: 1400px;
    margin: -0.5rem auto 3rem auto;
    padding: 0 2rem;
    width: 100%;
}

.footer-content {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--brand-color);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.footer-icon { font-size: 1.25rem; color: var(--brand-color); flex-shrink: 0; }
.footer-content p { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; }
.footer-content strong { color: var(--text-main); }
