/* ---------------------------------------------------------
 *** כללי תיקון קריטיים (איזון כוחות CSS) ***
 ---------------------------------------------------------- */

/* 1. כוח ההסתרה האגרסיבי (פותר את ערמת השלבים) */
/* זה חזק מספיק כדי לכבות כל שלב כאשר ה-JS מפעיל אותו */
#cpgem-wizard .cpgem-hidden-force {
    display: none !important;
    visibility: hidden !important;
}

/* 2. אילוץ הצגה לשלב 1 בטעינה ראשונית */
/* זה נשאר כדי להבטיח ששלב 1 גלוי בטעינה */
.cpgem-step[data-step="1"] {
    display: block !important;
}

/* 3. הסתרה ראשונית לשדות ה-SELECT המודרכים */
/* ה-JS ישלוט בהצגתם (באמצעות .show() או fadeIn()) */
#cpgem-series-select,
#cpgem-model-select {
    display: none; 
}

/* 4. אילוץ הצגה רק ליצרן (BRAND SELECT) בטעינה */
/* זה הכלל היחיד שצריך להיות חזק כדי להבטיח את הצגת שדה היצרן */
#cpgem-brand-select {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}


/* ---------------------------------------------------------
 *** סוף כללי התיקון הקריטיים ***
 ---------------------------------------------------------- */
/* ---------------------------------------------------------
 בסיס כללי
---------------------------------------------------------- */

#cpgem-wizard {
    direction: rtl;
    /* מומלץ לוודא שהגופן Rubik זמין או להחליף לגופן קיים באתר */
    font-family: 'Rubik', sans-serif;
    max-width: 720px;
    margin: 0 auto;
    padding: 20px;
}

/* ביטול הפיכת טקסט לכחול באייפון */
* {
    -webkit-tap-highlight-color: transparent;
}

a, a:visited, a:active {
    color: inherit !important;
    text-decoration: none !important;
}

/* ---------------------------------------------------------
 כותרות
---------------------------------------------------------- */

.cpgem-container h2 {
    margin-bottom: 18px;
    font-size: 26px;
    font-weight: 600;
}

.cpgem-container h3.cpgem-section-title {
    margin: 25px 0 10px;
    font-size: 20px;
    font-weight: 500;
}

/* ---------------------------------------------------------
 פרוגריס בר עליון
---------------------------------------------------------- */

.cpgem-progress-bar {
    text-align: center;
    margin-bottom: 25px;
}

.cpgem-progress-bar span {
    font-size: 16px;
}

.cpgem-steps-circles {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    gap: 10px;
}

.cpgem-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ccc;
    color: #444;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 15px;
}

.cpgem-step-circle.active {
    border-color: #93CF0F;
    background: #93CF0F;
    color: #fff;
}

/* ---------------------------------------------------------
 שלבים
---------------------------------------------------------- */

.cpgem-step { display: none; }
/* ה-JS מטפל בהצגת השלב הנוכחי עם fadeIn */
/* .cpgem-step.active { display: block; } */ 


/* ---------------------------------------------------------
 פילטרים / בחירת סוגים (דסקטופ)
---------------------------------------------------------- */

.cpgem-pill {
    padding: 10px 18px;
    border-radius: 999px;
    background: #f3f3f3;
    border: 1px solid #ddd;
    cursor: pointer;
    font-size: 15px;
    margin-inline: 5px;
    transition: 0.25s;
}

.cpgem-pill.active,
.cpgem-pill:hover {
    background: #93CF0F;
    border-color: #93CF0F;
    color: #fff;
}

.cpgem-samsung-series { margin-top: 18px; }

/* ---------------------------------------------------------
 Grid – דגמים (דסקטופ)
---------------------------------------------------------- */

.cpgem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 15px;
}

.cpgem-grid button {
    background: rgba(255,255,255,0.65);
    border: 1px solid rgba(0,0,0,0.08);
    padding: 16px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.25s;
    position: relative;
    font-size: 15px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.cpgem-grid button:hover,
.cpgem-grid button.active {
    background: rgba(147,207,15,0.15);
    border-color: #93CF0F;
}

.cpgem-grid img {
    width: 44px;
    height: 44px;
    margin-bottom: 8px;
}

/* ---------------------------------------------------------
 רשימת תיקונים (שלב 2) - נשאר כפי שתוקן
---------------------------------------------------------- */

.cpgem-repairs-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0;
    
    /* הגדרת רשת חיצונית רגילה */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 15px; 
}

/* 1. הגדרת ה-LI (הפריט החיצוני) */
.cpgem-repair-item {
    position: relative;  
    border: 1px solid rgba(0,0,0,0.1);
    padding: 0;  
    margin-bottom: 0;  
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    background: rgba(255,255,255,0.65);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    min-height: 200px;  
}

/* 2. התיקון הקריטי: הפיכת ה-LABEL ל-Flex Container אנכי עם פיזור שטח! */
.cpgem-repair-item label {
    display: flex;
    flex-direction: column;
    
    /* *** שינוי קריטי: פיזור פריטים אנכית (Icon למעלה, מחיר למטה) *** */
    justify-content: space-between;  
    
    /* *** שינוי קריטי: מרכוז פריטים אופקית *** */
    align-items: center;  
    
    text-align: center;  
    
    height: 100%; /* וודא שה-LABEL תופס את כל הגובה שקבענו ל-LI */
    width: 100%;
    box-sizing: border-box;
    padding: 20px 10px;  
}

/* בחירת הפריט */
.cpgem-repair-item.selected {
    border-color: #93CF0F;
    background: rgba(147,207,15,0.1);
    box-shadow: 0 0 15px rgba(147,207,15,0.5);
}

/* 3. אלמנט הבחירה (סימן V) */
.cpgem-item-checkbox {
    position: absolute;
    top: 15px;
    right: 15px; /* RTL */
    left: auto;
    
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-radius: 50%;
    margin: 0;  
    
    display: flex;  
    justify-content: center;
    align-items: center;
    
    font-size: 16px;
    color: #fff;
    transition: 0.2s;
    z-index: 10;  
}

.cpgem-repair-item.selected .cpgem-item-checkbox {
    background: #93CF0F;
    border-color: #93CF0F;
}

/* 4. מיכל האייקון */
.cpgem-item-icon {
    display: flex;  
    justify-content: center;
    align-items: center;
    width: 80px;  
    height: 80px;  
    margin: 0 0 10px 0;
    flex-shrink: 0;
}

/* התמונה עצמה בתוך המיכל */
.cpgem-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 5. פרטים: שם ותיאור */
.cpgem-item-details {
    margin-top: 5px; /* רווח קטן מתחת לאייקון */
    width: 100%;  
    text-align: center;
    display: block; 
    padding: 0 5px;  
}

.cpgem-item-label {
    font-weight: 600;
    font-size: 16px;
}

.cpgem-item-description {
    font-size: 13px;
    color: #666;
    margin-top: 3px;
    line-height: 1.3;
}

/* 6. מחיר וזמן */
.cpgem-item-price-time {
    text-align: center;  
    flex-shrink: 0;
    margin: 10px 0 0 0;  
}

/* ---------------------------------------------------------
 תג מומלץ
---------------------------------------------------------- */

.cpgem-tag-green {
    background: #93CF0F;
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    margin-top: 6px;
}

/* ---------------------------------------------------------
 הערת תיקון
---------------------------------------------------------- */

.cpgem-repair-note {
    margin-top: 8px;
    font-size: 13px;
    color: #555;
    background: rgba(255,255,255,0.35);
    padding: 6px 8px;
    border-radius: 10px;
    line-height: 1.35;
    text-align: center;
    backdrop-filter: blur(8px);
}

/* ---------------------------------------------------------
 תוספת WhatsApp
---------------------------------------------------------- */

#cpgem-wa-addon-row {
    margin-top: 18px;
    padding: 12px;
    background: rgba(255,255,255,0.45);
    border-radius: 14px;
    backdrop-filter: blur(10px);
}

/* ---------------------------------------------------------
 טופס פרטים אישיים
---------------------------------------------------------- */

#cpgem-wizard input,
#cpgem-wizard select,
#cpgem-wizard textarea {
    width: 100%;
    margin: 6px 0 14px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.55);
    font-size: 16px;
    backdrop-filter: blur(6px);
}

#cpgem-wizard input:focus,
#cpgem-wizard select:focus,
#cpgem-wizard textarea:focus {
    border-color: #93CF0F;
}

/* ---------------------------------------------------------
 טלפון
---------------------------------------------------------- */

.cpgem-phone {
    display: flex;
    align-items: center;
    gap: 10px;
    direction: ltr;
}

.cpgem-phone select { width: 110px; }
.cpgem-phone span { font-size: 20px; margin-top: -5px; }

/* ---------------------------------------------------------
 שגיאות והודעות
---------------------------------------------------------- */
.cpgem-global-message {
    color: #fff;
    background: #d60000;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 500;
}
.cpgem-global-message.cpgem-success { background: #93CF0F; }
.cpgem-global-message.cpgem-info { background: #007bff; }

.cpgem-error {
    color: #d60000 !important;
    font-size: 14px;
    display: block;
    margin-top: -6px;
    margin-bottom: 12px;
    font-weight: 600;
}

.cpgem-input-error {
    border-color: #d60000 !important;
}


/* ---------------------------------------------------------
 לוח שנה - *** מתוקן להתאמת JS (טבלת HTML) ***
---------------------------------------------------------- */

.cpgem-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
}

.cpgem-calendar-header span[data-nav] {
    cursor: pointer;
    font-size: 24px;
    padding: 0 10px;
}

.cpgem-calendar-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* חשוב כדי לוודא שכל התאים באותו גודל */
}

.cpgem-calendar-table th {
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.cpgem-calendar-table td {
    padding: 0;
    height: 45px; /* גובה קבוע לתא */
}

.cpgem-cal-day {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 16px;
    margin: 0 auto;
    max-width: 45px; /* רוחב מירבי של העיגול */
    background: transparent;
}

.cpgem-cal-day.available {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(6px);
}

.cpgem-cal-day.available:hover {
    background: rgba(147, 207, 15, 0.25);
    border-color: #93CF0F;
}

.cpgem-cal-day.selected {
    background: #93CF0F;
    border-color: #93CF0F;
    color: #fff;
    font-weight: 600;
}

.cpgem-cal-day.unavailable,
.cpgem-cal-day.past,
.cpgem-calendar-table td.not-in-month {
    cursor: default;
    background: transparent;
    color: #ccc;
    border-color: transparent;
}

/* ---------------------------------------------------------
 שעות פנויות - *** מתוקן להתאמת JS ***
---------------------------------------------------------- */

.cpgem-slots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.cpgem-time-slot {
    padding: 12px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    margin-bottom: 0;
    backdrop-filter: blur(6px);
    flex-grow: 1;
    min-width: 100px;
    font-size: 16px;
    color: #333;
    transition: 0.2s;
}

.cpgem-time-slot:hover,
.cpgem-time-slot.selected {
    background: #93CF0F;
    border-color: #93CF0F;
    color: #fff;
}

/* ---------------------------------------------------------
 כפתורים
---------------------------------------------------------- */

.cpgem-btn {
    padding: 16px 20px;
    border-radius: 14px;
    background: #93CF0F;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 17px;
    transition: background 0.2s;
}

.cpgem-btn.secondary { background: #333; }
.cpgem-btn:disabled { opacity: 0.6; cursor: not-allowed; }


.cpgem-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
}

/* ---------------------------------------------------------
 סיכום הזמנה
---------------------------------------------------------- */

#cpgem-summary {
    background: rgba(255,255,255,0.5);
    padding: 18px;
    border-radius: 16px;
    backdrop-filter: blur(8px);
    margin-top: 15px;
}

#cpgem-summary .item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-size: 15px;
    display: flex;
    justify-content: space-between;
}

/* הסרת float: left, שימוש ב-flex */
#cpgem-summary .item strong { 
    font-weight: bold;
}
#cpgem-summary .price {
    font-weight: bold;
}

#cpgem-summary-total {
    font-size: 20px;
    font-weight: bold;
    margin-top: 12px;
    text-align: center;
}

/* ---------------------------------------------------------
 מובייל – גרסת Combo VisionOS (בלי שינוי)
---------------------------------------------------------- */

@media (max-width: 480px) {
    /* סלקטורים במקום כפתורים */
    #cpgem-brand-select,
    #cpgem-series-select,
    #cpgem-model-select { /* תיקון השם של הסלקטורים בהתאם ל-JS */
        width: 100%;
        padding: 16px;
        font-size: 17px;
        border-radius: 18px;
        border: 1px solid rgba(0,0,0,0.15);
        margin-bottom: 16px;
        background: rgba(255,255,255,0.45);
        backdrop-filter: blur(14px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.06);
        appearance: none;
        background-image: url('data:image/svg+xml;utf8,<svg fill="%23888" height="30" viewBox="0 0 24 24" width="30" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
        background-repeat: no-repeat;
        background-position: left 12px center;
    }

    /* מסתיר את התצוגה המקורית */
    .cpgem-device-type-row,
    .cpgem-samsung-series,
    #cpgem-models-grid {
        display: none !important;
    }

    /* ... שאר סגנונות מובייל ... */
}
/* ---------------------------------------------------------
 תיקון ודאי: הצגת שדות בחירת דגם (אם נטענו יצרנים)
---------------------------------------------------------- */
#cpgem-brand-select,
#cpgem-series-select,
#cpgem-model-select {
    /* הכרח הצגה חזקה כדי לגבור על כלל חיצוני ששם display: none; */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
/* ---------------------------------------------------------
 *** תיקון קריטי להסתרה: Class אגרסיבי לכיבוי ***
---------------------------------------------------------- */
.cpgem-hidden-force {
    display: none !important; 
}