/* Dobyvezu Forms – frontend checkout CSS */
.dbv-custom-data-section {
    margin: 24px 0;
    padding: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: #fff;
}
.dbv-custom-data-section h3 {
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #d32f2f;
    font-size: 1.15em;
    color: #333;
}
.dbv-custom-data-section .form-row {
    margin-bottom: 12px;
}
.dbv-custom-data-section .form-row label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
}
.dbv-custom-data-section .form-row input:not([type=checkbox]):not([type=radio]),
.dbv-custom-data-section .form-row select,
.dbv-custom-data-section .form-row textarea {
    width: 100% !important;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}
.dbv-custom-data-section .form-row input:focus,
.dbv-custom-data-section .form-row select:focus,
.dbv-custom-data-section .form-row textarea:focus {
    border-color: #d32f2f;
    outline: none;
    box-shadow: 0 0 0 2px rgba(211,47,47,0.15);
}
.dbv-custom-data-section .form-row-wide { clear: both; }
.dbv-custom-data-section .form-row-first { float: left; width: 48%; }
.dbv-custom-data-section .form-row-last  { float: right; width: 48%; }
.dbv-custom-data-section abbr.required { text-decoration: none; color: #d32f2f; }
.dbv-custom-data-section .dbv-heading { margin: 16px 0 8px; font-size: 1.05em; }

/* Podmienené pole - skryté defaultne */
.dbv-custom-data-section .dbv-conditional-field { display: none; }

/* Validácia */
.dbv-custom-data-section .form-row.woocommerce-invalid input,
.dbv-custom-data-section .form-row.woocommerce-invalid select {
    border-color: #d32f2f;
}
.dbv-custom-data-section .form-row.woocommerce-validated input,
.dbv-custom-data-section .form-row.woocommerce-validated select {
    border-color: #4caf50;
}

/* Responsive */
@media only screen and (max-width: 767px) {
    .dbv-custom-data-section .form-row-first,
    .dbv-custom-data-section .form-row-last {
        float: none !important;
        width: 100% !important;
    }
}

/* ══════════════════════════════════════════════════════════
   Product Selector – kartičky produktov (doplnky) vo formulári
   ══════════════════════════════════════════════════════════ */
.dbv-product-selector-wrap {
    clear: both;
    margin: 20px 0 12px !important;
}
.dbv-ps-label {
    display: block;
    font-weight: 600;
    font-size: 1.08em;
    margin-bottom: 10px;
    color: #333;
}
.dbv-product-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

/* Kartička produktu */
.dbv-product-card {
    position: relative;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    background: #fff;
}
.dbv-product-card:hover {
    border-color: #bbb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Vybraná kartička */
.dbv-product-card.dbv-pc-selected {
    border-color: var(--wd-primary-color, #d32f2f);
    box-shadow: 0 0 0 3px rgba(211,47,47,0.15);
}
.dbv-product-card.dbv-pc-selected::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: var(--wd-primary-color, #d32f2f);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    z-index: 2;
    line-height: 1;
}

/* Loading stav */
.dbv-product-card.dbv-pc-loading {
    opacity: 0.5;
    pointer-events: none;
}
.dbv-product-card.dbv-pc-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(255,255,255,0.4) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23d32f2f" stroke-width="2"><path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"><animateTransform attributeName="transform" type="rotate" from="0 12 12" to="360 12 12" dur="1s" repeatCount="indefinite"/></path></svg>') center / 32px no-repeat;
}

/* Label (klikateľná oblasť) */
.dbv-pc-label {
    display: block;
    cursor: pointer;
    text-align: center;
    padding: 10px 8px 8px;
}
.dbv-pc-image img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    aspect-ratio: 1;
    object-fit: cover;
}
.dbv-pc-name {
    font-weight: 500;
    margin: 8px 0 2px;
    font-size: 13px;
    line-height: 1.3;
    color: #333;
}
.dbv-pc-price {
    color: var(--wd-primary-color, #d32f2f);
    font-weight: 700;
    font-size: 14px;
}

/* Variation select v kartičke */
.dbv-pc-variation-select {
    display: block;
    width: calc(100% - 16px);
    margin: 4px 8px 10px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 12px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s;
}
.dbv-pc-variation-select:focus {
    border-color: var(--wd-primary-color, #d32f2f);
    outline: none;
    box-shadow: 0 0 0 2px rgba(211,47,47,0.12);
}

/* Responsive: menšie kartičky na mobile */
@media only screen and (max-width: 767px) {
    .dbv-product-selector-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }
    .dbv-pc-label {
        padding: 6px 5px 5px;
    }
    .dbv-pc-name {
        font-size: 12px;
    }
    .dbv-pc-price {
        font-size: 13px;
    }
}

/* ══════════════════════════════════════════════════════════
   Distribúcia doplnkov – priradenie k pretekárom
   ══════════════════════════════════════════════════════════ */

/* Distribučná sekcia vo formulári */
.dbv-distribution-section {
    clear: both;
    margin: 20px 0 12px !important;
}
.dbv-distribution-section .dbv-ps-label {
    display: block;
    font-weight: 600;
    font-size: 1.08em;
    margin-bottom: 10px;
    color: #333;
}
.dbv-distribution-section .dbv-pc-label {
    padding-top: 34px; /* priestor pre badge */
    cursor: default;
}

/* Badge „Zostáva: X" / „2× priradené" */
.dbv-dist-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    background: #f5f5f5;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    z-index: 2;
    text-align: center;
    transition: background 0.2s, color 0.2s;
}
.dbv-dist-badge.dbv-dist-assigned {
    background: var(--wd-primary-color, #d32f2f);
    color: #fff;
}

/* Vybraná distribučná kartička */
.dbv-distribution-section .dbv-product-card.dbv-pc-selected {
    border-color: var(--wd-primary-color, #d32f2f);
    box-shadow: 0 0 0 3px rgba(211,47,47,0.15);
}
/* Skryť štandartný checkmark – badge ho nahrádza */
.dbv-distribution-section .dbv-product-card.dbv-pc-selected::after {
    display: none;
}

/* Qty ovládacie prvky (+/-) */
.dbv-dist-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px 10px;
    border-top: 1px solid #f0f0f0;
}
.dbv-dist-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    padding: 0;
}
.dbv-dist-btn:hover:not(:disabled) {
    border-color: var(--wd-primary-color, #d32f2f);
    color: var(--wd-primary-color, #d32f2f);
}
.dbv-dist-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.dbv-dist-qty-display {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: #333;
}
.dbv-pc-selected .dbv-dist-qty-display {
    color: var(--wd-primary-color, #d32f2f);
}

/* Zakázaná kartička – counter mode (plne priradený doplnok) */
.dbv-product-card.dbv-pc-disabled {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(80%);
}

/* ── Cards mode – obsadená kartička (priradená inému pretekárovi) ── */
.dbv-dist-unit-card .dbv-pc-label {
    cursor: pointer;
}
.dbv-dist-unit-card.dbv-dist-taken {
    opacity: 0.2;
    pointer-events: none;
    filter: grayscale(100%);
}
.dbv-dist-unit-card.dbv-dist-taken .dbv-dist-badge {
    background: #e0e0e0;
    color: #999;
    font-size: 10px;
}
.dbv-dist-unit-card .dbv-dist-badge {
    min-width: 28px;
    font-size: 12px;
}
.dbv-dist-unit-card.dbv-pc-selected .dbv-dist-badge {
    background: var(--wd-primary-color, #d32f2f);
    color: #fff;
    font-size: 14px;
}

/* ── Súhrnná lišta distribúcie ── */
.dbv-dist-summary {
    margin: 24px 0 16px;
    padding: 14px 18px;
    background: #fff8e1;
    border: 2px solid #ffc107;
    border-radius: 8px;
}
.dbv-dist-summary h4 {
    margin: 0 0 8px;
    font-size: 1em;
    color: #f57f17;
}
.dbv-dist-summary.dbv-dist-all-done {
    background: #e8f5e9;
    border-color: #4caf50;
}
.dbv-dist-summary.dbv-dist-all-done h4 {
    color: #2e7d32;
}
.dbv-dist-summary-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.dbv-dist-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #fff;
    border-radius: 16px;
    font-size: 13px;
    border: 1px solid #e0e0e0;
    transition: border-color 0.2s, background 0.2s;
}
.dbv-dist-summary-item.dbv-dist-complete {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}
.dbv-dist-summary-count {
    font-weight: 700;
}

/* Responsive distribúcia */
@media only screen and (max-width: 767px) {
    .dbv-dist-summary {
        padding: 10px 12px;
    }
    .dbv-dist-summary-items {
        gap: 6px;
    }
    .dbv-dist-summary-item {
        font-size: 12px;
        padding: 3px 8px;
    }
}

/* ── Dátum narodenia – 3 selecty ── */
.dbv-birth-date-wrap {
    margin-bottom: 12px;
}
.dbv-birth-date-wrap > label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
}
.dbv-birth-date-selects {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.dbv-birth-date-selects select {
    flex: 1;
    min-width: 90px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    appearance: auto;
    -webkit-appearance: auto;
    height: auto;
}
.dbv-birth-date-selects select:focus {
    border-color: #d32f2f;
    outline: none;
    box-shadow: 0 0 0 1px #d32f2f;
}
.dbv-birth-date-wrap.woocommerce-invalid .dbv-birth-date-selects select {
    border-color: #e2401c;
}
/* Telefón – notifikácia o formátovaní */
.dbv-phone-notice {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 3px;
    font-style: italic;
}
.dbv-phone-formatted {
    color: #46b450;
    font-weight: bold;
}
@media (max-width: 480px) {
    .dbv-birth-date-selects {
        flex-direction: column;
    }
    .dbv-birth-date-selects select {
        min-width: 100%;
    }
}
