
/* =========================================================
   LABRA – KÉPKIVÁGÁS
   ========================================================= */

#labraCropPage {
    --labra-red: #d9363e;
    --labra-red-dark: #bc2931;
    --labra-green: #2f7540;
    --labra-green-dark: #194d2a;
    --labra-green-light: #f3f8f2;
    --labra-text: #303530;
    --labra-muted: #747b74;
    --labra-border: #dce5da;

    width: 100%;
    color: var(--labra-text);
    font-family: inherit;
}

#labraCropPage *,
#labraCropPage *::before,
#labraCropPage *::after {
    box-sizing: border-box;
}


/* =========================================================
   FOLYAMAT
   ========================================================= */

.labra-steps {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    margin: 10px 0 35px;
    padding: 0 10px;
}

.labra-step {
    position: relative;
    flex: 1;

    text-align: center;

    color: #a0a5a0;

    text-decoration: none !important;
}

.labra-step:not(:last-child)::after {
    content: "";

    position: absolute;
    top: 23px;
    left: 65%;

    width: 70%;

    border-top: 2px dashed #d7dbd7;

    z-index: 0;
}

.labra-step-circle {
    position: relative;
    z-index: 2;

    width: 48px;
    height: 48px;

    margin: 0 auto 9px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 2px solid #d7dbd7;
    border-radius: 50%;

    background: #fff;

    font-weight: 600;

    transition:
        background .2s ease,
        border-color .2s ease,
        color .2s ease,
        box-shadow .2s ease;
}

.labra-step-title {
    display: block;

    font-size: 14px;
}


/* kész */

.labra-step.done {
    color: var(--labra-green);
}

.labra-step.done .labra-step-circle {
    border-color: var(--labra-green);

    color: var(--labra-green);
}


/* aktív */

.labra-step.active {
    color: var(--labra-green);
}

.labra-step.active .labra-step-circle {
    background: var(--labra-green);

    border-color: var(--labra-green);

    color: #fff;
}

.labra-step.active .labra-step-title {
    font-weight: 700;
}


/* link */

.labra-step-link {
    cursor: pointer;

    transition:
        transform .2s ease,
        color .2s ease;
}

.labra-step-link:hover {
    transform: translateY(-2px);

    color: var(--labra-green-dark);
}

.labra-step-link:hover .labra-step-circle {
    background: var(--labra-green);

    color: #fff;

    box-shadow:
        0 5px 14px rgba(47,117,64,.18);
}


/* =========================================================
   INFO
   ========================================================= */

.labra-crop-info {
    display: flex;
    align-items: center;

    gap: 15px;

    margin-bottom: 25px;
    padding: 17px 20px;

    background: var(--labra-green-light);

    border: 1px solid var(--labra-border);
    border-radius: 12px;
}

.labra-info-icon {
    width: 36px;
    height: 36px;

    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--labra-green);
    color: #fff;

    font-weight: bold;
}

.labra-info-content {
    font-size: 14px;
    line-height: 1.55;
}


/* =========================================================
   HEADER
   ========================================================= */

.labra-section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 16px;
}

.labra-section-header h2 {
    margin: 0 0 4px;

    font-size: 24px;
}

.labra-section-header p {
    margin: 0;

    color: var(--labra-muted);

    font-size: 14px;
}

.labra-cart-count {
    display: none;

    padding: 7px 13px;

    background: #e8f3e8;
    color: var(--labra-green);

    border-radius: 20px;

    font-size: 13px;
    font-weight: 700;
}

.labra-cart-count.visible {
    display: inline-block;
}


/* =========================================================
   CART ITEMS
   ========================================================= */

#cart-container {
    display: flex;
    flex-direction: column;

    gap: 18px;
}

.labra-crop-card {
    display: grid;

    grid-template-columns:
        minmax(360px,46%)
        1fr;

    gap: 27px;

    align-items: center;

    padding: 20px;

    background: #fff;

    border: 1px solid #e1e5e1;
    border-radius: 16px;

    box-shadow:
        0 4px 18px rgba(32,52,38,.05);
}

.labra-konva-wrap {
    padding: 10px;

    background: #eef2ed;

    border-radius: 13px;
}

.konva-container {
    width: 100%;

    aspect-ratio: 320 / 220;

    overflow: hidden;

    background: #dedfdb;

    border-radius: 9px;
}

.konva-container canvas {
    max-width: 100% !important;
}


/* =========================================================
   DETAILS
   ========================================================= */

.labra-size-badge {
    display: inline-flex;

    margin-bottom: 10px;
    padding: 5px 10px;

    background: #e9f3e9;
    color: var(--labra-green);

    border-radius: 16px;

    font-size: 12px;
    font-weight: 700;
}

.labra-cart-details h3 {
    margin: 0 0 14px;

    font-size: 22px;
}

.labra-properties {
    display: grid;

    grid-template-columns:
        repeat(2,minmax(0,1fr));

    gap: 10px;

    margin-bottom: 17px;
}

/* Tulajdonság kártya */
.labra-property {
    min-width: 0;
    width: 100%;

    padding: 11px 12px;

    background: #f8f9f7;

    border: 1px solid #ebedeb;
    border-radius: 9px;

    overflow: hidden;
}

.labra-property-label {
    display: block;

    color: var(--labra-muted);

    font-size: 11px;
}

/* Tulajdonság értéke */
.labra-property-value {
    display: block;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: var(--labra-text);

    font-size: 14px;
    font-weight: 600;

    cursor: default;
}

.labra-crop-help {
    display: flex;

    gap: 10px;

    padding: 12px 13px;

    background: #fff8ef;

    border-radius: 9px;

    font-size: 13px;
    line-height: 1.45;
}


/* =========================================================
   EMPTY / LOADING
   ========================================================= */

.labra-loading,
.labra-empty-cart {
    padding: 55px 25px;

    text-align: center;

    background: #fff;

    border: 1px solid #e2e5e2;
    border-radius: 16px;

    color: var(--labra-muted);
}

.labra-loader {
    width: 34px;
    height: 34px;

    margin: 0 auto 13px;

    border: 3px solid #e1e6e0;
    border-top-color: var(--labra-green);

    border-radius: 50%;

    animation: spin .8s linear infinite;
}

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


/* =========================================================
   ACTION BAR
   ========================================================= */

#labraActionBar {
    display: none;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-top: 25px;
    padding: 17px 19px;

    background: var(--labra-green-light);

    border: 1px solid var(--labra-border);
    border-radius: 14px;
}

#labraActionBar.visible {
    display: flex;
}

.labra-action-info {
    color: var(--labra-muted);

    font-size: 13px;
}

.labra-action-info strong {
    display: block;

    color: var(--labra-text);

    font-size: 14px;
}

#save-positions {
    min-width: 285px;

    padding: 13px 24px;

    border: 0;
    border-radius: 25px;

    background: var(--labra-red);
    color: #fff;

    cursor: pointer;

    font-family: inherit;
    font-weight: 650;
}

#save-positions:hover:not(:disabled) {
    background: var(--labra-red-dark);
}

#save-positions:disabled {
    opacity: .5;
}


/* =========================================================
   STATUS
   ========================================================= */

#labraSaveStatus {
    display: none;

    margin-top: 13px;
    padding: 11px 14px;

    border-radius: 9px;
}

#labraSaveStatus.visible {
    display: block;
}

#labraSaveStatus.success {
    background: #edf7ed;

    color: #246b36;
}

#labraSaveStatus.error {
    background: #fff0f0;

    color: #b12831;
}


/* =========================================================
   MOBIL
   ========================================================= */

@media(max-width:768px) {

    .labra-step-circle {
        width: 40px;
        height: 40px;
    }

    .labra-step:not(:last-child)::after {
        top: 19px;
    }

    .labra-step:not(.active) .labra-step-title {
        display: none;
    }


    .labra-crop-card {
        grid-template-columns: 1fr;
    }


    .labra-properties {
        grid-template-columns: 1fr 1fr;
    }


    #labraActionBar {
        flex-direction: column;
        align-items: stretch;
    }

    #save-positions {
        width: 100%;
        min-width: 0;
    }

}

/* Bounded canvas lifecycle and explicit saving state. */
#labraCropPage.labra-saving #cart-container { pointer-events:none; opacity:.7; }
#labraCropPage button:disabled { opacity:.55; cursor:wait; }
#labraCropPage .labra-crop-retry { margin-top:12px; padding:8px 12px; font-size:13px; }
#labraCropPage .konva-container { min-height:100px; overflow:hidden; }
