/* Heka Cotizador v3.0 — Page Styles */

.heka-cot-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 0;
    font-family: 'Open Sans', -apple-system, sans-serif;
}

/* Header */
.heka-cot-header {
    text-align: center;
    margin-bottom: 2rem;
}
.heka-cot-header h2 {
    font-size: 1.75rem;
    color: #1E293B;
    margin: 0 0 0.5rem;
}
.heka-cot-header p {
    color: #64748B;
    font-size: 0.95rem;
}

/* Sections */
.heka-cot-section {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.heka-cot-section h3 {
    font-size: 1.1rem;
    color: #1E293B;
    margin: 0 0 0.5rem;
}
.heka-section-desc {
    color: #64748B;
    font-size: 0.85rem;
    margin: 0 0 1rem;
}

/* Upload zone — using <label> for native mobile file picker */
.heka-upload-zone {
    display: block;
    border: 2px dashed #CBD5E1;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
}
.heka-upload-zone:hover,
.heka-upload-zone.heka-drag-over {
    border-color: #0D9488;
    background: #F0FDFA;
}
.heka-upload-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}
.heka-upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.heka-upload-zone strong {
    display: block;
    color: #1E293B;
    margin-bottom: 0.25rem;
}
.heka-upload-zone small {
    display: block;
    color: #94A3B8;
    font-size: 0.8rem;
}

/* Messages */
.heka-msg {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin: 1rem 0;
}
.heka-msg.error { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.heka-msg.success { background: #F0FDF4; color: #16A34A; border: 1px solid #BBF7D0; }
.heka-msg.info { background: #EFF6FF; color: #3B82F6; border: 1px solid #BFDBFE; }

/* Not found list */
.heka-not-found {
    margin-top: 1rem;
    padding: 1rem;
    background: #FFF7ED;
    border-radius: 8px;
    border: 1px solid #FED7AA;
}
.heka-not-found h4 {
    margin: 0 0 0.5rem;
    color: #C2410C;
    font-size: 0.9rem;
}
.heka-not-found ul {
    margin: 0;
    padding: 0 0 0 1.25rem;
    font-size: 0.85rem;
    color: #9A3412;
}
.heka-not-found li {
    margin-bottom: 0.25rem;
}

/* List header */
.heka-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.heka-list-header h3 {
    margin: 0;
}

/* Empty state */
.heka-empty-state {
    text-align: center;
    padding: 2rem;
    color: #94A3B8;
}
.heka-empty-state a {
    color: #0D9488;
    font-weight: 600;
}

/* Quote table */
.heka-quote-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.heka-quote-table thead th {
    background: #F1F5F9;
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    border-bottom: 2px solid #E2E8F0;
    white-space: nowrap;
}
.heka-quote-table tbody td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid #F1F5F9;
    color: #1E293B;
    vertical-align: middle;
}
.heka-quote-table tbody tr:hover {
    background: #F8FAFC;
}
.heka-desc-cell {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.heka-quote-table code {
    background: #F1F5F9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #475569;
}

/* Quantity input */
.heka-qty-input {
    width: 70px !important;
    padding: 4px 8px !important;
    border: 1.5px solid #E2E8F0 !important;
    border-radius: 6px !important;
    text-align: center;
    font-size: 0.875rem !important;
}
.heka-qty-input:focus {
    border-color: #0D9488 !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.1) !important;
}

/* Remove button */
.heka-remove-item {
    background: none !important;
    border: none !important;
    color: #CBD5E1 !important;
    cursor: pointer;
    font-size: 1.1rem !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    transition: all 0.15s;
    line-height: 1 !important;
}
.heka-remove-item:hover {
    color: #EF4444 !important;
    background: #FEF2F2 !important;
}

/* Drag handle */
.heka-drag-handle {
    cursor: grab;
    color: #CBD5E1;
    font-size: 1.2rem;
    text-align: center;
    width: 30px;
    user-select: none;
    -webkit-user-select: none;
    padding: 0.5rem 4px !important;
    transition: color 0.15s;
}
.heka-drag-handle:hover {
    color: #0D9488;
}
.heka-drag-handle:active {
    cursor: grabbing;
}
.heka-col-drag {
    width: 30px;
}

/* Drag states */
.heka-dragging {
    opacity: 0.4;
    background: #F0FDFA !important;
}
.heka-drag-over-row {
    border-top: 3px solid #0D9488 !important;
}
.heka-drag-over-row td {
    position: relative;
}
tr[draggable="true"] {
    cursor: default;
}
tr[draggable="true"] td {
    transition: background 0.15s;
}

/* Total row */
.heka-total-row td {
    border-top: 2px solid #E2E8F0;
    padding-top: 1rem;
    font-weight: 700;
}
.heka-total-label {
    text-align: right;
    color: #475569;
    font-size: 0.95rem;
}
.heka-total-value {
    color: #0D9488;
    font-size: 1.1rem;
}

/* Client fields */
.heka-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}
.heka-field {
    margin-bottom: 1rem;
}
.heka-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.25rem;
}
.heka-field input,
.heka-field textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1.5px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.875rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.heka-field input:focus,
.heka-field textarea:focus {
    outline: none;
    border-color: #0D9488;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.1);
}
.heka-field textarea {
    resize: vertical;
    min-height: 60px;
}

.heka-client-info {
    padding: 0.75rem 1rem;
    background: #F0FDF4;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #166534;
}
.heka-client-info p { margin: 0; }

/* Buttons */
.heka-btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0D9488 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 0.875rem 2rem !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none !important;
}
.heka-btn-submit:hover {
    background: #0F766E !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}
.heka-btn-submit:disabled {
    background: #94A3B8 !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.heka-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff !important;
    color: #0D9488 !important;
    border: 2px solid #0D9488 !important;
    border-radius: 10px !important;
    padding: 0.75rem 2rem !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none !important;
}
.heka-btn-outline:hover {
    background: #F0FDFA !important;
    color: #0D9488 !important;
}
.heka-btn-text {
    background: none !important;
    border: none !important;
    color: #EF4444 !important;
    font-size: 0.85rem !important;
    cursor: pointer;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
}
.heka-btn-text:hover {
    background: #FEF2F2 !important;
}

.heka-submit-actions {
    text-align: center;
    margin-top: 1.5rem;
}

/* Success state */
.heka-success-state {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
}
.heka-success-icon {
    width: 64px;
    height: 64px;
    background: #10B981;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}
.heka-success-state h3 {
    color: #1E293B;
    margin: 0 0 0.5rem;
}
.heka-success-state p {
    color: #64748B;
    margin-bottom: 2rem;
}
.heka-success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive */

/* Table scroll container */
#heka-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

@media (max-width: 768px) {
    .heka-cot-page {
        padding: 0.5rem 0;
    }
    .heka-grid-3 {
        grid-template-columns: 1fr;
    }
    .heka-cot-section {
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    .heka-cot-header h2 {
        font-size: 1.3rem;
    }
    .heka-cot-header p {
        font-size: 0.85rem;
    }
    .heka-list-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    /* Table scrollable */
    #heka-table-wrap {
        margin: 0 -1rem;
        padding: 0;
    }
    .heka-quote-table {
        font-size: 0.8rem;
        min-width: 480px;
    }
    .heka-quote-table thead th,
    .heka-quote-table tbody td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
    .heka-desc-cell {
        white-space: normal !important;
        min-width: 160px;
        max-width: 200px;
    }
    .heka-qty-input {
        width: 50px !important;
        padding: 3px 4px !important;
    }
    .heka-drag-handle {
        padding: 0.5rem 2px !important;
        font-size: 1rem;
    }
    .heka-col-drag {
        width: 24px;
    }

    /* Upload zone */
    .heka-upload-zone {
        padding: 1.5rem 1rem;
    }
    .heka-upload-icon {
        font-size: 1.5rem;
    }

    /* Submit */
    .heka-btn-submit,
    .heka-btn-outline {
        width: 100% !important;
        justify-content: center;
    }
    .heka-submit-actions {
        margin-top: 1rem;
    }
    .heka-success-actions {
        flex-direction: column;
    }
}

@media (max-width: 380px) {
    .heka-cot-section {
        padding: 0.75rem;
    }
    .heka-quote-table {
        font-size: 0.75rem;
        min-width: 420px;
    }
}
