/**
 * 1002A Calculator
 *
 * @author    THECON
 * @copyright THECON
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

#thonethousand2a_form {
    box-shadow: 0 3px 6px #00000029;
    border-radius: 20px;
    padding: 40px;
    display: flex;
    flex-wrap: wrap;
}

#thonethousand2a_form .submit_calculate {
    margin: 0 auto;
    display: block;
    font-size: 16px;
    background-color: #DC2A0B;
    border-color: #DC2A0B;
    border-radius: 5px;
}

#thonethousand2a_form label {
    font-weight: 700;
}

#thonethousand2a_form input, #thonethousand2a_form select {
    border-radius: 5px;
}

#product #thonethousand2a_form select {
    height: 34px;
}

#thonethousand2a_form .btn_submit_calculate {
    margin: 0 auto;
}

#thonethousand2a_form .btn_submit_calculate .submit_add_to_cart_wrapper {
    display: none;
}

#thonethousand2a_form .btn_submit_calculate .submit_add_to_cart {
    display: flex;
    padding: 0;
    font-size: 18px;
    align-items: center;
    border-radius: 5px;
    border-color: #DC2A0B;
}

#thonethousand2a_form .btn_submit_calculate .submit_add_to_cart i {
    background-color: #DC2A0B;
    padding: 8px;
    color: #fff;
    margin: 0;
    font-size: 20px;
}

#thonethousand2a_form .btn_submit_calculate .submit_add_to_cart span {
    margin-right: 20px;
    margin-left: 20px;
    color: #000000;
    font-weight: 600;
}

@media (min-width: 992px) {
    #thonethousand2a_form .col-lg-6 {
        flex: 48%;
        margin-right: 5px;
        margin-left: 5px;
    }
}

/* Step containers */
.step-container {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    transition: all 0.3s ease;
}

#step-basic {
    margin-bottom: 20px;
}

#step-holes-config {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

#step-holes-config .step-title {
    margin-bottom: 15px;
}

#step-holes-config .step-title h4 {
    color: #333;
    font-size: 18px;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #DC2A0B;
}

/* Holes position selector (radio buttons) */
.holes-position-selector {
    display: flex;
    gap: 30px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.holes-position-selector label.radio-inline {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.holes-position-selector label.radio-inline:hover {
    border-color: #DC2A0B;
}

.holes-position-selector input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #DC2A0B;
}

.holes-position-selector input[type="radio"]:checked + span,
.holes-position-selector label.radio-inline:has(input:checked) {
    border-color: #DC2A0B;
    background-color: #fff5f5;
}

/* Cote inputs container */
#cote-container {
    padding: 10px 0;
}

.cote-inputs-wrapper {
    width: 100%;
}

.cote-info {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    font-style: italic;
}

.cote-input-group {
    margin-bottom: 15px;
}

.cote-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.cote-input-group input.cota-input {
    width: 100%;
    max-width: 200px;
}

.cota-input.input-error {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
}

/* Hole diagram */
#hole-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#hole-diagram img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

/* X calculated display */
#x-calculated-container {
    margin-top: 15px;
}

.x-calculated-box {
    background-color: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 15px 20px;
    display: inline-block;
    font-size: 16px;
}

.x-calculated-box .x-label {
    font-weight: 600;
    color: #2e7d32;
    margin-right: 10px;
}

.x-calculated-box #x-value {
    font-weight: 700;
    font-size: 20px;
    color: #1b5e20;
}

/* Error messages */
.cote-error-message {
    color: #dc3545;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
}

.cote-error-message .error-item {
    padding: 10px 15px;
    background-color: #fff5f5;
    border-left: 4px solid #dc3545;
    margin-bottom: 8px;
    border-radius: 0 4px 4px 0;
    font-size: 15px;
}

/* Inline error messages - afișate direct sub input */
.cote-input-group .inline-error {
    color: #dc3545;
    font-size: 14px;
    font-weight: 600;
    margin-top: 8px;
    padding: 10px 15px;
    background-color: #fff5f5;
    border-left: 4px solid #dc3545;
    border-radius: 0 4px 4px 0;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

#max-holes-error {
    width: 100%;
    margin: 10px 0;
}

#max-holes-error .alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    font-weight: 600;
}

/* Step final */
#step-final {
    background-color: #fff;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .holes-position-selector {
        flex-direction: column;
        gap: 15px;
    }

    .holes-position-selector label.radio-inline {
        justify-content: center;
    }

    #cote-container,
    #hole-diagram {
        width: 100%;
    }

    .cote-input-group input.cota-input {
        max-width: 100%;
    }
}

@media (min-width: 992px) {
    #step-holes-config .col-lg-6 {
        flex: 0 0 48%;
        max-width: 48%;
    }
}

/* Colors for Cote Inputs matching diagrams */
#cota_1 {
    border-color: #2196F3 !important;
    color: #2196F3 !important;
    font-weight: bold;
    border-width: 2px !important;
}

#cota_2 {
    border-color: #FF9800 !important;
    color: #FF9800 !important;
    font-weight: bold;
    border-width: 2px !important;
}

#cota_3 {
    border-color: #9C27B0 !important;
    color: #9C27B0 !important;
    font-weight: bold;
    border-width: 2px !important;
}

#cota_4 {
    border-color: #E91E63 !important;
    color: #E91E63 !important;
    font-weight: bold;
    border-width: 2px !important;
}

#cota_5 {
    border-color: #00BCD4 !important;
    color: #00BCD4 !important;
    font-weight: bold;
    border-width: 2px !important;
}

/* =====================================================
   INTERACTIVE DIAGRAM STYLES - Inputuri integrate în diagramă
   ===================================================== */

/* Container principal pentru diagrama interactivă */
#interactive-diagram-container {
    width: 100%;
    padding: 10px 0;
}

.diagram-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 10px;
}

.diagram-title {
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 15px;
    color: #333;
    background-color: #f5f5f5;
    padding: 8px 15px;
    border-radius: 5px;
}

/* Dreptunghi mobilă - mai lat */
.furniture-frame {
    position: relative;
    width: 220px;
    height: 350px;
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
    border: 3px solid #333;
    border-radius: 6px;
    margin: 0 auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Poziționare frame stânga/dreapta - Reset to centered, handled by JS transform now */
.furniture-frame.stanga {
    margin: 0 auto;
}

.furniture-frame.dreapta {
    margin: 0 auto;
}

/* Indicatoare margini min 100mm */
.margin-indicator {
    position: absolute;
    font-size: 15px;
    color: #888;
    font-style: italic;
    white-space: nowrap;
}

.furniture-frame.stanga .margin-indicator {
    right: -75px;
}

.furniture-frame.dreapta .margin-indicator {
    left: -75px;
}

.margin-indicator.top {
    top: -21px;
    z-index: 20;
}

.margin-indicator.bottom {
    bottom: 5px;
}

/* Rând pentru fiecare gaură - poziționare absolută */
.hole-row {
    position: absolute;
    display: flex;
    align-items: center;
    height: 40px;
    z-index: 10;
}

/* Poziționare hole-row pentru stânga (inputuri în dreapta frame-ului) */
.furniture-frame.stanga .hole-row {
    left: 100%;
    flex-direction: row;
    padding-left: 120px;
}

/* Poziționare hole-row pentru dreapta (inputuri în stânga frame-ului) */
.furniture-frame.dreapta .hole-row {
    right: 100%;
    flex-direction: row-reverse;
    padding-right: 120px;
}

/* Container pentru input și eroare inline */
.hole-row .input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Input integrat în diagramă */
.cota-input-inline {
    width: 85px;
    height: 34px;
    border: 2px solid #2196F3;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    background-color: #fff;
    transition: all 0.2s ease;
}

.cota-input-inline:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3);
}

.cota-input-inline.input-error {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
    animation: shake 0.3s ease-in-out;
}

/* Linie săgeată întreruptă */
.arrow-line {
    width: 30px;
    height: 0;
    border-top: 2px dashed #666;
    margin: 0 8px;
}

/* Cerc pentru numărul găurii - Inside Frame */
.hole-circle-inside {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #333;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 20;
}

/* Connector Line (Dashed) */
.connector-line {
    position: absolute;
    height: 0;
    border-top: 2px dashed #666;
    z-index: 5;
}

/* Absolute Input Wrapper */
.input-wrapper-absolute {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 15;
    width: 85px; /* Match input width */
}

/* Elevated Z-Index for Error Display */
.input-wrapper-absolute.z-elevated {
    z-index: 1000 !important;
}

/* X row specific */
.input-wrapper-absolute.x-row-input {
    z-index: 10;
}

/* Eroare inline pentru inputuri absolute */
.input-wrapper-absolute .inline-error-container {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 200px; /* Fixed width to allow wrapping */
    pointer-events: none; /* Let clicks pass through */
}

.input-wrapper-absolute .inline-error {
    display: block;
    color: #dc3545;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
    padding: 5px 8px;
    background-color: #fff5f5;
    border: 1px solid #dc3545;
    border-radius: 3px;
    white-space: normal; /* Allow wrapping */
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Vertical Dimensions Arrows */
.dimension-arrow.vertical {
    position: absolute;
    top: 0;
    width: 0;
    border-left: 2px solid;
    z-index: 8; 
}

.dimension-arrow .arrow-head {
    position: absolute;
    bottom: 0;
    left: -5px; /* Centered on 2px border: -5 + 1 = -4 visual center? No. Border is 2px. Center is 1px. Arrow head is 10px wide? */
    /* Previous CSS:
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid;
    */
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid;
}

/* Remove old hole-row specific positioning that is no longer used or conflicts */
/* We still might need some cleanup but new elements use new classes */

/* Responsive pentru diagrama interactivă */
@media (max-width: 576px) {
    .diagram-wrapper {
        padding: 15px 5px;
    }

    .furniture-frame {
        width: 100px;
        height: 280px;
    }

    .furniture-frame.stanga {
        margin-right: 75px;
    }

    .furniture-frame.dreapta {
        margin-left: 75px;
    }

    .cota-input-inline {
        width: 70px;
        height: 30px;
        font-size: 12px;
    }

    .arrow-line {
        width: 20px;
    }

    .hole-circle {
        width: 22px;
        height: 22px;
        min-width: 22px;
        font-size: 11px;
    }

    .margin-indicator {
        font-size: 9px;
    }

    .furniture-frame.stanga .margin-indicator {
        right: -60px;
    }

    .furniture-frame.dreapta .margin-indicator {
        left: -60px;
    }

    /* Adjust connector and arrow on small screens if needed */
    .dimension-connector.horizontal {
        border-bottom-width: 1px;
    }
    .dimension-arrow.vertical {
        border-left-width: 1px;
    }
    .dimension-arrow .arrow-head {
        border-width: 6px 3px 0 3px; /* Smaller arrow head */
        left: -3px;
    }

    #thonethousand2a_form {
        padding: 20px;
    }

    .input-wrapper-absolute .inline-error-container {
        left: 100%;
    }
}
