/**
 * Public Price Ranges Styles
 *
 * @package Teledom_Orders
 * @since 2.0.0
 */

/* Has Ranges Price Display */
.has-ranges-price {
    position: relative;
    cursor: pointer;
    overflow: visible !important;
    z-index: 1;
}

.has-ranges-price:hover {
    z-index: 100;
}

/* Ensure parent containers don't clip tooltip */
.preview-product-card,
.preview-product-card .preview-product-price,
.product-card,
.product-card.has-ranges,
.product-card .product-price-wrapper,
.product-card .product-footer,
.category-products-preview,
.category-section,
.products-grid,
.products-section,
.products-cart-container,
.teledom-step-2 {
    overflow: visible !important;
}

.has-ranges-price .price-prefix {
    font-size: 12px;
    color: #6b7280;
    font-weight: normal;
}

/* Ranges Info Icon */
.ranges-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 4px;
    color: #0073aa;
    transition: color 0.2s ease;
}

.ranges-info-icon:hover {
    color: #005177;
}

.ranges-info-icon .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Ranges Tooltip */
.ranges-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: auto;
    transform: none;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    min-width: 300px;
    max-width: 380px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    margin-bottom: 8px;
}

.ranges-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    transform: none;
    border: 8px solid transparent;
    border-top-color: #fff;
}

.ranges-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 19px;
    transform: none;
    border: 9px solid transparent;
    border-top-color: #e5e7eb;
}

/* Show tooltip on hover - CSS only */
.has-ranges-price:hover > .ranges-tooltip,
.has-ranges-price:hover .ranges-tooltip {
    opacity: 1;
    visibility: visible;
    z-index: 999999;
    pointer-events: auto;
}

.ranges-tooltip-header {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.ranges-tooltip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.ranges-tooltip-item:not(:last-child) {
    border-bottom: 1px dashed #f3f4f6;
}

.ranges-tooltip-item.range-base {
    background: #f0fdf4;
    margin: 0 -12px;
    padding: 8px 12px;
    border-radius: 4px;
}

.ranges-tooltip-item .range-label {
    color: #4b5563;
}

.ranges-tooltip-item .range-price {
    font-weight: 600;
    color: #059669;
}

/* ============================================
   Ranges Tooltip Table Format (Enhanced)
   ============================================ */

.ranges-tooltip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.ranges-tooltip-table thead th {
    text-align: left;
    padding: 6px 8px;
    font-weight: 600;
    color: #6b7280;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
}

.ranges-tooltip-table thead th.col-price,
.ranges-tooltip-table thead th.col-discount {
    text-align: right;
}

.ranges-tooltip-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.ranges-tooltip-table tbody tr:last-child {
    border-bottom: none;
}

.ranges-tooltip-table tbody tr:hover {
    background-color: #f9fafb;
}

.ranges-tooltip-table tbody tr.is-base {
    background-color: #f0fdf4;
}

.ranges-tooltip-table tbody tr.is-base:hover {
    background-color: #dcfce7;
}

.ranges-tooltip-table tbody tr.has-discount {
    background-color: #fefce8;
}

.ranges-tooltip-table tbody tr.has-discount:hover {
    background-color: #fef9c3;
}

.ranges-tooltip-table td {
    padding: 8px;
    vertical-align: top;
}

.ranges-tooltip-table td.col-range {
    width: 33%;
}

.ranges-tooltip-table td.col-price {
    width: 45%;
    text-align: right;
}

.ranges-tooltip-table td.col-discount {
    width: 20%;
    text-align: right;
}

.ranges-tooltip-table .range-label {
    font-weight: 500;
    color: #374151;
    display: block;
}

.ranges-tooltip-table .price-main {
    font-weight: 600;
    color: #059669;
    display: block;
    font-size: 13px;
}

.ranges-tooltip-table .price-breakdown {
    display: block;
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
}

.ranges-tooltip-table .discount-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
    color: #9ca3af;
}

.ranges-tooltip-table .discount-badge.active {
    background-color: #fef3c7;
    color: #b45309;
}

/* Duration type indicator in tooltip */
.ranges-tooltip-table tr[data-duration-type="hourly"] .range-label::before {
    content: '';
}

.ranges-tooltip-table tr[data-duration-type="daily"] .range-label::before {
    content: '';
}

/* VAT toggle aware - bez DPH mode */
.vat-mode-without-vat .ranges-tooltip-table .price-main {
    /* Will be updated via JS */
}

/* Price Ranges Popup */
.price-range-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.price-range-popup {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.price-range-popup .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.price-range-popup .popup-header h3 {
    margin: 0;
    font-size: 18px;
    color: #111827;
}

.price-range-popup .close-popup {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.price-range-popup .close-popup:hover {
    color: #111827;
}

.price-range-popup .popup-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Duration Type Selector */
.duration-type-selector {
    margin-bottom: 20px;
}

.duration-type-selector label {
    display: block;
    font-weight: 500;
    margin-bottom: 10px;
    color: #374151;
}

.duration-type-selector .type-options {
    display: flex;
    gap: 10px;
}

.duration-type-selector .type-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.duration-type-selector .type-option:hover {
    border-color: #3b82f6;
}

.duration-type-selector .type-option input {
    display: none;
}

.duration-type-selector .type-option input:checked + span {
    color: #3b82f6;
    font-weight: 600;
}

.duration-type-selector .type-option:has(input:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
}

/* Duration Input */
.duration-input-section {
    margin-bottom: 20px;
}

.duration-input-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
}

.duration-input-section input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
}

.duration-input-section input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Ranges Info */
.ranges-info {
    background: #f9fafb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.ranges-info-header {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    margin-bottom: 10px;
}

.ranges-info .range-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.ranges-info .range-item.active {
    background: #ecfdf5;
    border-color: #10b981;
}

.ranges-info .range-item .range-label {
    color: #4b5563;
    font-size: 13px;
}

.ranges-info .range-item .range-price {
    font-weight: 600;
    color: #059669;
    font-size: 13px;
}

.ranges-info .no-ranges {
    color: #6b7280;
    font-size: 13px;
    font-style: italic;
}

/* Price Result */
.price-result {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 15px;
}

.price-result .applied-range {
    font-size: 12px;
    color: #166534;
    margin-bottom: 10px;
}

.price-result .calculated-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-result .price-label {
    font-weight: 500;
    color: #374151;
}

.price-result .price-value {
    font-size: 24px;
    font-weight: 700;
    color: #059669;
}

.price-result .price-breakdown {
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
}

.price-result .price-breakdown small {
    color: #9ca3af;
}

/* Popup Footer */
.price-range-popup .popup-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.price-range-popup .popup-footer .button {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.price-range-popup .popup-footer .cancel-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
}

.price-range-popup .popup-footer .add-to-cart-btn {
    background: #059669;
    border: none;
    color: #fff;
}

.price-range-popup .popup-footer .add-to-cart-btn:hover {
    background: #047857;
}

/* Popup Price Ranges Section (inside product popup) */
.popup-price-ranges {
    margin-bottom: 20px;
}

.popup-price-ranges h3 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.popup-price-ranges .ranges-info-note {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 15px 0;
    font-style: italic;
}

.popup-price-ranges .ranges-info-table {
    background: #f9fafb;
    border-radius: 8px;
}

.popup-price-ranges .range-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.popup-price-ranges .range-row:last-child {
    margin-bottom: 0;
}

.popup-price-ranges .range-row.range-base {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.popup-price-ranges .range-row .range-label {
    font-size: 14px;
    color: #374151;
}

.popup-price-ranges .range-row .range-price {
    font-size: 14px;
    font-weight: 600;
    color: #059669;
}

.popup-price-ranges .range-row.range-base .range-label {
    color: #166534;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .price-range-popup {
        max-height: 100vh;
        border-radius: 0;
    }

    .duration-type-selector .type-options {
        flex-direction: column;
    }

    .price-result .calculated-price {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .popup-price-ranges .range-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Tooltip table responsive */
    .ranges-tooltip {
        min-width: 280px;
        max-width: 95vw;
        left: 0;
        transform: none;
        right: auto;
    }

    .ranges-tooltip-table {
        font-size: 11px;
    }

    .ranges-tooltip-table thead th {
        padding: 4px 6px;
        font-size: 10px;
    }

    .ranges-tooltip-table td {
        padding: 6px;
    }

    .ranges-tooltip-table .price-main {
        font-size: 12px;
    }

    .ranges-tooltip-table .price-breakdown {
        font-size: 9px;
    }

    .ranges-tooltip-table .discount-badge {
        font-size: 10px;
        padding: 1px 4px;
    }
}

/* ============================================
   Booking Mode Selector (Hodinovo / Denne)
   ============================================ */

.booking-mode-selector {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
    border: 1px solid #0073aa;
    border-radius: 6px;
    overflow: hidden;
}

.booking-mode-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: #fff;
    color: #0073aa;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.booking-mode-btn:not(:first-child) {
    border-left: 1px solid #0073aa;
}

.booking-mode-btn:hover:not(.active) {
    background: #f0f7fc;
}

.booking-mode-btn.active {
    background: #0073aa;
    color: #fff;
}

.booking-mode-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Daily custom time fields */
.booking-daily-time-fields {
    margin-bottom: 12px;
}

.booking-daily-time-fields label {
    cursor: pointer;
}

.booking-daily-time-fields .daily-time-inputs {
    margin-top: 10px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .booking-mode-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .booking-mode-btn .dashicons {
        font-size: 12px;
        width: 12px;
        height: 12px;
    }
}

/* ============================================
   "Prejsť k výberu času" Button
   ============================================ */

.ranges-tooltip-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.btn-go-to-booking {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-go-to-booking:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-go-to-booking:active {
    transform: translateY(0);
}

.btn-go-to-booking .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ============================================
   Calendar Highlight Pulse Animation
   ============================================ */

@keyframes highlight-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 115, 170, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(0, 115, 170, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 115, 170, 0);
    }
}

.popup-mini-calendar.highlight-pulse {
    animation: highlight-pulse 0.5s ease 3;
    border-radius: 6px;
}

/* ============================================
   Popup Button States
   ============================================ */

/* "Prejsť k výberu času" state - blue button */
.popup-add-to-cart.go-to-booking-state {
    background: linear-gradient(135deg, #0073aa 0%, #005d8c 100%) !important;
    border-color: #0073aa !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.popup-add-to-cart.go-to-booking-state:hover {
    background: linear-gradient(135deg, #005d8c 0%, #004a73 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.popup-add-to-cart.go-to-booking-state .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ============================================
   Collapsed Price Ranges
   ============================================ */

.popup-price-ranges.collapsed {
    margin-bottom: 0;
}

.popup-price-ranges.collapsed h3 {
    display: none;
}

/* Ranges collapsed summary */
.ranges-collapsed-summary {
    transition: all 0.3s ease;
}

.ranges-expand-btn {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ranges-expand-btn:hover {
    background: rgba(0, 115, 170, 0.1);
    text-decoration: none;
}
