/* ==========================================================================
   GK Product Specifications Widget Styles
   ========================================================================== */

/* --- کانتینر اصلی --- */
.gk-spec-container {
    position: relative;
    background: var(--gk-surface, #ffffff);
    border: 1px solid var(--gk-border, #e5e7eb);
    border-radius: var(--gk-radius, 12px);
    padding: 32px;
    direction: rtl;
    text-align: right;
    margin-bottom: var(--gk-grid-gap-y, 30px);
    box-shadow: var(--gk-shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
}

.gk-spec-main-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--gk-text, #1f2937);
    margin: 0 0 32px 0;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--gk-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* --- ساختار محتوا و انیمیشن --- */
.gk-spec-content-wrap {
    overflow: hidden;
    transition: max-height var(--gk-duration-slow, 0.5s) cubic-bezier(0.4, 0, 0.2, 1);
}

.gk-spec-fade {
    position: absolute;
    bottom: 50px; /* بالای دکمه */
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--gk-surface, #ffffff));
    pointer-events: none;
    z-index: 1;
}

/* --- استایل بخش‌ها (چیدمان عمودی) --- */
.gk-spec-section {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--gk-border, #f3f4f6);
    padding-bottom: 24px;
    margin-bottom: 24px;
}
.gk-spec-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* عنوان گروه ویژگی‌ها */
.gk-spec-section-title {
    width: 100%;
    padding: 0 0 16px 0;
    display: flex;
    align-items: center;
}

.gk-spec-section-title h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gk-text, #1f2937);
    margin: 0;
    line-height: 1.6;
    position: relative;
    padding-right: 14px;
}

/* نشانگر رنگی کنار عنوان */
.gk-spec-section-title h3::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 16px;
    background-color: var(--gk-primary);
    border-radius: 4px;
}

/* --- استایل آیتم‌ها (ردیف ویژگی‌ها) --- */
.gk-spec-item-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gk-spec-item {
    display: flex;
    padding: 14px 16px;
    border-radius: var(--gk-radius-sm, 8px);
    background-color: var(--gk-background, #f9fafb);
    transition: background-color var(--gk-duration-fast, 0.2s) ease;
}

.gk-spec-item:hover {
    background-color: var(--gk-surface-hover, #f3f4f6);
}

.gk-spec-label {
    width: 30%;
    color: var(--gk-text-muted, #6b7280);
    font-size: 0.95rem;
    font-weight: 500;
    padding-left: 16px;
}

.gk-spec-value {
    flex: 1;
    color: var(--gk-text, #111827);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.6;
}

/* لینک‌های داخل مقادیر */
.gk-spec-link {
    color: var(--gk-primary);
    text-decoration: none;
    position: relative;
    transition: color var(--gk-duration-fast, 0.2s);
}
.gk-spec-link::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--gk-primary);
    transform-origin: bottom right;
    transition: transform var(--gk-duration-fast, 0.2s) ease-out;
}
.gk-spec-link:hover {
    color: var(--gk-secondary, var(--gk-primary));
}
.gk-spec-link:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* --- دکمه مشاهده بیشتر / کمتر --- */
.gk-spec-trigger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--gk-primary);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    padding: 20px 0 0 0;
    margin-top: 16px;
    border-top: 1px solid var(--gk-border, #e5e7eb);
    transition: all var(--gk-duration-fast, 0.2s) ease;
    position: relative;
    z-index: 2;
}

.gk-spec-trigger-btn:hover {
    color: var(--gk-secondary, var(--gk-primary));
    opacity: 0.8;
}
.gk-spec-trigger-btn i {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}
.is-expanded .gk-spec-trigger-btn i {
    transform: rotate(180deg);
}

/* ==========================================================================
   Mobile Modal Styles (App-like UI)
   ========================================================================== */
.gk-spec-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.gk-spec-modal.active { display: flex; }

.gk-spec-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--gk-duration, 0.3s);
}
.gk-spec-modal.active .gk-spec-modal-backdrop { opacity: 1; }

.gk-spec-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 85vh;
    background: var(--gk-surface, #ffffff);
    border-radius: var(--gk-radius-lg, 24px) var(--gk-radius-lg, 24px) 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--gk-duration, 0.3s) cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 2;
}
.gk-spec-modal-content.slide-up { transform: translateY(0); }

/* خط کشیدنی بالای مدال (Indicator) */
.gk-spec-modal-content::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background-color: var(--gk-border, #e5e7eb);
    border-radius: 4px;
}

.gk-spec-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--gk-border, #f3f4f6);
}
.gk-spec-modal-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gk-text, #111827);
}
.gk-spec-modal-close {
    background: var(--gk-background, #f3f4f6);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    color: var(--gk-text-muted, #4b5563);
    transition: all var(--gk-duration-fast, 0.2s);
}
.gk-spec-modal-close:hover {
    background: var(--gk-border, #e5e7eb);
    color: var(--gk-text, #111827);
}

.gk-spec-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    direction: rtl;
}

body.gk-modal-open { overflow: hidden; }

/* ==========================================================================
   Responsive Adjustments (Mobile)
   ========================================================================== */
@media (max-width: 768px) {
    .gk-spec-container {
        padding: 20px;
        border-radius: var(--gk-radius, 12px);
    }

    .gk-spec-main-title {
        font-size: 1.1rem;
        margin-bottom: 24px;
    }

    .gk-spec-section {
        margin-bottom: 24px;
    }

    .gk-spec-section-title h3 {
        font-size: 1rem;
    }

    .gk-spec-item {
        padding: 12px 10px;
        background: transparent;
        border-bottom: 1px dashed var(--gk-border, #e5e7eb);
        border-radius: 0;
    }
    .gk-spec-item:last-child {
        border-bottom: none;
    }

    .gk-spec-label {
        width: 40%; /* در موبایل کمی بیشتر فضا بگیرد */
        font-size: 0.85rem;
        padding-left: 8px;
    }

    .gk-spec-value {
        font-size: 0.85rem;
        text-align: left;
    }
}

/* v1.8.2 - Align Digikala Pro specs with modern product description card */
.gk-spec-container--modern-card {
    --gk-spec-accent: var(--gk-primary, #0ea5e9);
    overflow: visible;
    border: 1px solid rgba(17,24,39,.08);
    background: linear-gradient(180deg, var(--gk-surface, #fff) 0%, color-mix(in srgb, var(--gk-surface, #fff) 92%, var(--gk-spec-accent) 8%) 100%);
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 18px 45px rgba(15,23,42,.055);
}
.gk-spec-heading-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}
.gk-spec-heading-icon {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 16px;
    color: var(--gk-spec-accent);
    background: color-mix(in srgb, var(--gk-spec-accent) 11%, #fff);
}
.gk-spec-heading-icon svg { width: 22px; height: 22px; display: block; }
.gk-spec-heading-texts { min-width: 0; }
.gk-spec-container--modern-card .gk-spec-main-title {
    margin: 0;
    padding: 0;
    border: 0;
    display: block;
    color: var(--gk-text, #111827);
    font-size: 20px;
    line-height: 1.6;
    font-weight: 900;
}
.gk-spec-main-subtitle {
    margin: 4px 0 0;
    color: var(--gk-text-muted, #64748b);
    font-size: 13px;
    line-height: 1.9;
    font-weight: 600;
}
.gk-spec-container--modern-card .gk-spec-section {
    padding: 18px 0;
    margin: 0;
    border-bottom-color: rgba(17,24,39,.07);
}
.gk-spec-container--modern-card .gk-spec-section:first-child { padding-top: 0; }
.gk-spec-container--modern-card .gk-spec-section-title { padding: 0 0 12px; }
.gk-spec-container--modern-card .gk-spec-section-title h3 {
    color: var(--gk-text, #111827);
    font-weight: 900;
    font-size: 15px;
}
.gk-spec-container--modern-card .gk-spec-section-title h3::before {
    background-color: var(--gk-spec-accent);
}
.gk-spec-container--modern-card .gk-spec-item-list { gap: 10px; }
.gk-spec-container--modern-card .gk-spec-item {
    border: 1px solid rgba(17,24,39,.045);
    border-radius: 16px;
    background: color-mix(in srgb, var(--gk-surface, #fff) 86%, var(--gk-spec-accent) 3%);
    padding: 13px 15px;
    align-items: flex-start;
}
.gk-spec-container--modern-card .gk-spec-item:hover {
    background: color-mix(in srgb, var(--gk-surface, #fff) 78%, var(--gk-spec-accent) 8%);
}
.gk-spec-container--modern-card .gk-spec-label {
    color: var(--gk-text-muted, #6b7280);
    font-weight: 800;
    line-height: 1.9;
}
.gk-spec-container--modern-card .gk-spec-value {
    color: var(--gk-text, #111827);
    font-weight: 900;
    line-height: 1.9;
}
.gk-spec-container--modern-card .gk-spec-fade {
    background: linear-gradient(to bottom, transparent, var(--gk-surface, #fff));
}
.gk-spec-container--modern-card .gk-spec-trigger-btn {
    margin-top: 14px;
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, var(--gk-spec-accent) 28%, transparent);
    background: color-mix(in srgb, var(--gk-spec-accent) 9%, #fff);
    color: var(--gk-spec-accent);
    border-radius: 14px;
    width: auto;
    min-width: 170px;
    margin-inline: auto;
    border-top-color: color-mix(in srgb, var(--gk-spec-accent) 28%, transparent);
    font-weight: 900;
}
.gk-spec-container--modern-card .gk-spec-trigger-btn:hover {
    opacity: 1;
    background: var(--gk-spec-accent);
    color: #fff;
    transform: translateY(-1px);
}
.gk-spec-modal-content {
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -24px 70px rgba(15,23,42,.24);
}
.gk-spec-modal-body .gk-spec-section {
    border-bottom-color: rgba(17,24,39,.08);
}
@media (max-width: 768px) {
    .gk-spec-container--modern-card { padding: 18px; border-radius: 20px; }
    .gk-spec-heading-row { gap: 10px; margin-bottom: 14px; }
    .gk-spec-heading-icon { width: 40px; height: 40px; border-radius: 14px; }
    .gk-spec-container--modern-card .gk-spec-main-title { font-size: 18px; }
    .gk-spec-container--modern-card .gk-spec-item {
        background: color-mix(in srgb, var(--gk-surface, #fff) 88%, var(--gk-spec-accent) 4%);
        border: 1px solid rgba(17,24,39,.055);
        border-radius: 14px;
    }
}

/* Anchor/highlight when Attributes Swiper "View all" scrolls to specs */
.gk-spec-container[data-gk-product-specs-target="1"] {
    scroll-margin-top: var(--gk-spec-scroll-offset, 110px);
}
.gk-spec-container.gk-spec-scroll-highlight {
    animation: gk-spec-scroll-pulse 1.6s ease both;
}
@keyframes gk-spec-scroll-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gk-primary, #ef4056) 34%, transparent), var(--gk-shadow-sm, 0 1px 3px rgba(0,0,0,.05)); }
    45% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--gk-primary, #ef4056) 14%, transparent), var(--gk-shadow-sm, 0 1px 3px rgba(0,0,0,.05)); }
    100% { box-shadow: var(--gk-shadow-sm, 0 1px 3px rgba(0,0,0,.05)); }
}
