/* =============================================

   Price Chart Modal
   ============================================= */

/* Overlay */
.price-chart-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.price-chart-modal.show {
    opacity: 1 !important;
}

body.modal-open {
    overflow: hidden;
}

/* Modal Box */
.price-chart-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--woocustom-surface, #fff);
    border-radius: 20px;
    max-width: 860px;
    width: 92%;
    padding: 28px 28px 24px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.25);
    font-family: inherit;
    scrollbar-width: thin;
    scrollbar-color: var(--woocustom-border-strong, #d1d5db) transparent;
}

.price-chart-modal-content::-webkit-scrollbar {
    width: 5px;
}

.price-chart-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.price-chart-modal-content::-webkit-scrollbar-thumb {
    background: var(--woocustom-border-strong, #d1d5db);
    border-radius: var(--woocustom-radius-md, 12px);
}

/* دکمه بستن */
button.price-chart-modal-close {
    height: 36px !important;
    width: 36px !important;
    color: var(--woocustom-text, #1f2937) !important;
    padding: 10px !important;
}
.price-chart-modal-close {
    float: left;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--woocustom-surface-soft, #f8fafc) !important;
    border: none;
    border-radius: var(--woocustom-radius-md, 12px);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    position: relative;
    z-index: 10;
}

.price-chart-modal-close:hover,
.price-chart-modal-close:focus {
    background: var(--woocustom-border-strong, #d1d5db) !important;
    transform: scale(1.08);
    outline: none;
}

/* Modal Body */
.price-chart-modal-body {
    clear: both;
    padding-top: 8px;
}

/* هدر مودال */
.modal-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--woocustom-border, #e5e7eb);
}

.modal-header h2 {
    margin: 0 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: var(--woocustom-color-secondary, #1F2937) !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
}

.modal-header h3 {
    margin: 0 !important;
    font-size: 15px !important;
    color: var(--woocustom-muted, #6b7280) !important;
    font-weight: 400 !important;
    font-family: inherit !important;
    line-height: 1.5 !important;
}

/* =============================================
   Loader
   ============================================= */
.modal-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 60px 20px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--woocustom-border, #e5e7eb);
    border-top-color: var(--woocustom-color-primary);
    border-radius: 50%;
    animation: wcSpinnerSpin 0.85s linear infinite;
}

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

.loader-text {
    margin: 0;
    font-size: 14px;
    color: var(--woocustom-muted, #6b7280);
    font-family: inherit;
}

/* =============================================
   Chart Container
   ============================================= */
.chart-container {
    position: relative;
    height: 340px;
    margin: 16px 0 20px;
    background: var(--woocustom-surface-soft, #f8fafc);
    border: 1px solid var(--woocustom-border, #e5e7eb);
    border-radius: var(--woocustom-radius-lg, 18px);
    padding: 16px 12px 12px;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease;
}

.chart-container:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
}

.chart-container canvas {
    font-family: inherit !important;
}

/* =============================================
   Tabs
   ============================================= */
.tabs-header {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.tab-button {
    padding: 7px 18px;
    background: var(--woocustom-surface-soft, #f8fafc);
    border: 1.5px solid var(--woocustom-border-strong, #d1d5db);
    border-radius: var(--woocustom-radius-md, 12px);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit !important;
    font-size: 13px;
    font-weight: 500;
    color: var(--woocustom-text, #1f2937);
    line-height: 1.5;
}

.tab-button:hover {
    background: var(--woocustom-border, #e5e7eb);
    border-color: var(--woocustom-border-strong, #d1d5db);
    color: var(--woocustom-color-secondary, #1F2937);
}

.tab-button.active {
    background: var(--woocustom-color-primary);
    color: #fff;
    border-color: var(--woocustom-color-primary);
    box-shadow: 0 3px 12px var(--woocustom-primary-soft-strong, rgba(var(--woocustom-primary-rgb), .18));
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: wcTabFadeIn 0.25s ease;
}

@keyframes wcTabFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   No Data Message
   ============================================= */
.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 48px 24px;
    background: var(--woocustom-surface-soft, #f8fafc);
    border: 1px dashed var(--woocustom-border-strong, #d1d5db);
    border-radius: var(--woocustom-radius-lg, 18px);
    color: var(--woocustom-muted, #6b7280);
    font-family: inherit !important;
    margin: 16px 0;
}

.no-data-icon {
    font-size: 36px;
    line-height: 1;
    margin-bottom: 4px;
}

.no-data-message p {
    margin: 0 !important;
    font-size: 15px;
    color: var(--woocustom-muted, #6b7280);
}

.no-data-hint {
    font-size: 13px !important;
    color: var(--woocustom-muted, #6b7280) !important;
    background: var(--woocustom-border, #e5e7eb);
    padding: 6px 14px;
    border-radius: var(--woocustom-radius-sm, 8px);
}

.no-data-current-price {
    font-size: 14px !important;
    color: var(--woocustom-text, #1f2937) !important;
    margin-top: 4px !important;
}

.no-data-current-price strong {
    color: var(--woocustom-color-primary);
}

/* =============================================
   Latest Change Date
   ============================================= */
.latest-change-date {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
    padding: 10px 16px;
    background: var(--woocustom-surface-soft, #f8fafc);
    border-radius: var(--woocustom-radius-md, 12px);
    color: var(--woocustom-muted, #6b7280);
    font-size: 13px;
    font-family: inherit !important;
    border: 1px solid var(--woocustom-border, #e5e7eb);
}

.date-label {
    font-weight: 600;
    color: var(--woocustom-muted, #6b7280);
}

/* =============================================
   Icon Button
   ============================================= */
.price-chart-icon-container {
    display: inline-flex;
    align-items: center;
}

.price-chart-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--woocustom-radius-sm, 8px);
    color: inherit;
    transition: color 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.price-chart-icon-button:hover {
    color: var(--woocustom-color-primary);
    transform: scale(1.12);
    background: var(--woocustom-primary-soft, rgba(var(--woocustom-primary-rgb), .10));
}

.price-chart-icon-button:focus {
    outline: 2px solid var(--woocustom-color-primary);
    outline-offset: 2px;
}

.price-chart-icon-button svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .price-chart-modal-content {
        width: 96%;
        max-height: 92vh;
        padding: 18px 16px;
        border-radius: var(--woocustom-radius-lg, 18px);
    }

    .chart-container {
        height: 280px;
        padding: 10px 8px;
    }

    .tabs-header {
        justify-content: center;
    }

    .tab-button {
        font-size: 12px;
        padding: 6px 14px;
    }

    .modal-header h2 {
        font-size: 17px !important;
    }

    .modal-header h3 {
        font-size: 13px !important;
    }
}

@media (max-width: 480px) {
    .price-chart-modal-content {
        width: 100%;
        max-height: 95vh;
        padding: 14px 12px;
        border-radius: 14px 14px 0 0;
        top: auto;
        bottom: 0;
        left: 0;
        transform: translateX(0);
        position: fixed;
    }

    .chart-container {
        height: 240px;
    }

    .tabs-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tab-button {
        width: 100%;
        text-align: center;
    }

    .no-data-message {
        padding: 32px 16px;
    }
}

/* WooCustom 1.60.18 - align price chart modal with review modal */
.price-chart-modal {
    padding: 16px;
    background: rgba(15, 23, 42, .52);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-y: auto;
}

.price-chart-modal-content {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: min(860px, 100%);
    max-width: 860px;
    max-height: none;
    margin: clamp(16px, 4vh, 42px) auto;
    padding: 0;
    overflow: hidden;
    direction: rtl;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .22);
}

.price-chart-modal-body {
    clear: none;
    padding: 24px 28px 28px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.price-chart-modal-body::-webkit-scrollbar {
    width: 6px;
}

.price-chart-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.price-chart-modal-close,
button.price-chart-modal-close {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    float: none;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff !important;
    color: #334155 !important;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
    transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}

.price-chart-modal-close svg {
    width: 20px;
    height: 20px;
}

.price-chart-modal-close:hover,
.price-chart-modal-close:focus {
    color: #0f172a !important;
    background: #f8fafc !important;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    outline: none;
}

.price-chart-modal .modal-header {
    margin: -24px -28px 24px;
    padding: 28px 72px 20px 28px;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.price-chart-modal .modal-header h2 {
    margin: 0 0 8px !important;
    padding: 0;
    border: 0;
    color: #0f172a !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.45 !important;
    letter-spacing: -0.02em;
}

.price-chart-modal .modal-header h3 {
    margin: 0 !important;
    color: #64748b !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.9 !important;
}

@media (max-width: 640px) {
    .price-chart-modal {
        padding: 12px;
    }
    .price-chart-modal-content {
        width: 100%;
        margin: 12px auto;
        border-radius: 22px;
    }
    .price-chart-modal-body {
        padding: 20px;
        max-height: calc(100vh - 48px);
    }
    .price-chart-modal .modal-header {
        margin: -20px -20px 20px;
        padding: 24px 64px 16px 20px;
    }
}

/* Static initial states and icon alignment. */
.price-chart-modal .modal-loader { display: none; }
.woocustom-calendar-svg { vertical-align: middle; margin-left: 4px; }
