/**
 * Style V2 - CreateQuotation Redesign
 *
 * Extends style.css. Loaded after style.css in index.html.
 * Hero Upload, Part Card V2, Chip Selectors, Sidebar, Responsive.
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

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

@keyframes drawPath {
    to { stroke-dashoffset: 0; }
}

@keyframes pulse-subtle {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(249, 115, 22, 0); }
}

/* ── Layout principal ── */
.main-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px;
    display: grid;
    gap: 20px;
    transition: grid-template-columns 0.3s ease;
}

.main-layout.has-parts {
    grid-template-columns: 1fr 280px;
}

.main-layout.empty-state {
    grid-template-columns: 1fr;
}

/* ── Hero Upload (empty state) ── */
.hero-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
    animation: fadeUp 0.6s ease-out;
}

.hero-upload__title {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a2e;
    font-family: 'DM Sans', 'Roboto', sans-serif;
    margin-bottom: 10px;
}

.hero-upload__subtitle {
    color: #6b7b8d;
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
}

.hero-upload__dropzone {
    width: 100%;
    max-width: 600px;
    border: 2px dashed #d0d5dd;
    border-radius: 16px;
    background: #fafbfc;
    padding: 50px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    animation: fadeUp 0.8s ease-out;
}

.hero-upload__dropzone:hover,
.hero-upload__dropzone.dragover {
    border-color: #c8850f;
    background: #fef9f0;
    transform: scale(1.01);
    box-shadow: 0 8px 30px rgba(200,133,15,0.12);
}

.hero-upload__icon-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c8850f 0%, #a06b0a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 20px rgba(200,133,15,0.25);
}

.hero-upload__format-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #f0f2f5;
    color: #5a6a7a;
    letter-spacing: 0.5px;
}

.hero-upload__steps {
    display: flex;
    gap: 40px;
    margin-top: 50px;
    opacity: 0.7;
    animation: fadeUp 1s ease-out;
}

.hero-upload__step {
    text-align: center;
    position: relative;
}

.hero-upload__step-icon { font-size: 24px; margin-bottom: 6px; }
.hero-upload__step-label { font-size: 11px; color: #8896a6; font-weight: 500; }
.hero-upload__step-arrow {
    position: absolute;
    right: -28px;
    top: 12px;
    color: #d0d5dd;
    font-size: 14px;
}

/* ── Part Card V2 ── */
.part-card-v2 {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e8ecf0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    overflow: hidden;
    animation: fadeUp 0.5s ease-out;
    margin-bottom: 16px;
}

/* Header colapsable */
.part-card-v2__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8f9fb;
    border-bottom: 1px solid #eef1f4;
    cursor: pointer;
    transition: background 0.15s;
    gap: 12px;
}

.part-card-v2__header:hover {
    background: #f0f2f5;
}

.part-card-v2__header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.part-card-v2__header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.part-card-v2__header-prices {
    text-align: right;
}

/* Thumbnail wrapper in header */
.part-card-v2__thumb {
    width: 64px;
    height: 48px;
    border-radius: 6px;
    background: #f0f2f5;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e2e6ea;
}

.part-card-v2__thumb canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.part-card-v2__header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.part-card-v2__filename {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.part-card-v2__dimensions-hint {
    font-size: 12px;
    color: #8896a6;
}

.part-card-v2__header-price {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.part-card-v2__header-unit-price {
    font-size: 11px;
    color: #8896a6;
}

.part-card-v2__delete {
    background: none;
    border: none;
    color: #c0c8d0;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.part-card-v2__delete:hover {
    color: #e53e3e;
    background: #fff5f5;
}

.part-card-v2__toggle {
    transition: transform 0.2s;
    font-size: 12px;
    color: #8896a6;
}

.part-card-v2__toggle.collapsed {
    transform: rotate(-90deg);
}

/* Body expandido: single column */
.part-card-v2__body {
    padding: 16px 20px;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

.part-card-v2__body.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0 20px;
}

/* Geometry badges — compact inline row */
.part-card-v2__geometry-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef1f4;
}

.part-card-v2__geo-badge-inline {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #f4f6f8;
    border-radius: 8px;
    font-size: 12px;
}

.part-card-v2__geo-badge-icon { font-size: 13px; }

.part-card-v2__geo-badge-label {
    color: #8896a6;
    font-weight: 500;
}

.part-card-v2__geo-badge-value {
    font-weight: 600;
    color: #2d3748;
}

/* Config sections — 2x2 grid for compactness */
.part-card-v2__config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    margin-bottom: 14px;
}

.config-section {
    margin-bottom: 20px;
}

.config-section__label {
    font-size: 12px;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

/* Config dropdowns — 2x2 grid */
.config-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.config-section-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-section-compact__label {
    font-size: 11px;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.config-select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e2e6ea;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #2d3748;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
    appearance: auto;
}

.config-select:focus {
    outline: none;
    border-color: #c8850f;
    box-shadow: 0 0 0 3px rgba(200, 133, 15, 0.1);
}

.config-select:hover {
    border-color: #c8850f;
}

/* Procesos extra (checkboxes inline) */
.processes-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.process-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1.5px solid #e2e6ea;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.process-chip.active {
    border-color: #c8850f;
    background: #fef6e8;
    color: #9a6a0a;
}

.process-chip input[type="checkbox"] {
    display: inline-block;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #c8850f;
}

/* Quantity stepper (in header) */
.quantity-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.quantity-stepper__btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #e2e6ea;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.quantity-stepper__btn:hover {
    border-color: #c8850f;
    background: #fef6e8;
    color: #c8850f;
}

.quantity-stepper__input {
    width: 90px;
    text-align: center;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #e2e6ea;
    font-size: 14px;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: #2d3748;
}

.quantity-stepper__input:focus {
    outline: none;
    border-color: #c8850f;
}

/* ── Dropzone compacta ── */
.dropzone-compact {
    border: 2px dashed #d0d5dd;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafbfc;
}

.dropzone-compact:hover {
    border-color: #c8850f;
    background: #fef9f0;
}

.dropzone-compact__plus {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e8ecf0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #8896a6;
}

/* ── Sidebar sticky ── */
.order-sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
    animation: fadeUp 0.4s ease-out;
}

.order-sidebar__card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e8ecf0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.order-sidebar__card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eef1f4;
    background: #f8f9fb;
}

.order-sidebar__card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.order-sidebar__card-body {
    padding: 16px 20px;
}

.order-sidebar__part-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #4a5568;
    padding: 8px 0;
    border-bottom: 1px solid #f4f5f7;
}

.order-sidebar__part-row:last-of-type {
    border-bottom: none;
}

.order-sidebar__part-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
    font-weight: 500;
}

.order-sidebar__part-price {
    font-weight: 600;
}

.order-sidebar__subtotal-row {
    border-top: 2px solid #1a1a2e;
    margin-top: 12px;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.order-sidebar__subtotal-label {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
}

.order-sidebar__subtotal-value {
    font-size: 18px;
    font-weight: 800;
    color: #1a1a2e;
}

.order-sidebar__note {
    font-size: 11px;
    color: #a0aab4;
    margin-top: 4px;
}

.order-sidebar__continue-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #5a8f3c 0%, #4a7830 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(90,143,60,0.3);
    transition: all 0.2s;
    font-family: inherit;
}

.order-sidebar__continue-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 6px 20px rgba(90,143,60,0.35);
}

.order-sidebar__continue-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.order-sidebar__action-card {
    margin-top: 12px;
    padding: 14px 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.order-sidebar__action-card:hover {
    border-color: #c8850f;
    background: #fffcf5;
}

.order-sidebar__action-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
}

.order-sidebar__action-subtitle {
    font-size: 11px;
    color: #a0aab4;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .main-layout.has-parts {
        grid-template-columns: 1fr;
    }
    .order-sidebar {
        position: relative;
        top: 0;
    }
    .config-grid-2x2 {
        grid-template-columns: 1fr;
    }
    .part-card-v2__geometry-row {
        flex-direction: column;
    }
    .part-card-v2__thumb {
        width: 48px;
        height: 36px;
    }
}
