/* Specific styles for index page body to override booking page styles */
body.index-page {
    display: block;
    padding: 0;
}
body.index-page::after { /* The dark overlay should not appear on the index page */
    display: none;
}

#pageTitle {
    background-color: #f0f2f5;
    padding: 20px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    margin: 30px 0 0 0;
    text-align: left;
    color: #0078fb;
    font-size: 1.5rem;
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

#categoryGrid {
    background-color: #f0f2f5;
    padding: 0 20px 20px 20px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    margin-top: 0;
}

.device-card {
    text-decoration: none;
    color: #1c1e21;
    border: 1px solid #dddfe2;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease-in-out;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.device-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    border-color: #007aff;
}
.device-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
    transition: all 0.2s ease-in-out;
}
.device-card span {
    font-weight: 600;
    font-size: 1rem;
    color: #021b3b;
}
.recently-added-container {
    background-color: #f0f2f5;
    padding: 20px 5px;
    border-radius: 12px;
    margin-top: 30px;
}
.recently-added-container h2 {
    color: #0078fb;
    margin-bottom: 20px;
    text-align: left;
    padding-left: 15px;
    font-size: 1.5rem;
}
.slider-wrapper {
    position: relative;
    padding: 0 5px;
}
.device-grid-slider {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    gap: 20px;
    padding-bottom: 10px;
}
.device-grid-slider::-webkit-scrollbar {
    display: none;
}
.device-grid-slider .device-card {
    flex: 0 0 calc((100% - 20px) / 2);
    min-width: calc((100% - 20px) / 2);
}

@media (min-width: 600px) {
    .device-grid-slider .device-card {
        flex: 0 0 150px;
        min-width: 150px;
    }
}

/* --- Slider Arrow Styles --- */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-size: 24px;
    color: #333;
}
.slider-arrow:hover {
    background-color: white;
}
.left-arrow {
    left: -20px;
}
.right-arrow {
    right: -20px;
}


/* --- NEW STYLES FOR BRAND/DEVICE SELECTOR --- */
.brand-device-container {
    position: relative;
    margin: 30px 0 0 0;
    background-color: #f0f2f5;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.box-header {
    background-color: #021b3b;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    border-radius: 0;
    margin-bottom: 0;
}

.back-button {
    width: 32px;
    height: 32px;
    cursor: pointer;
    margin-right: 15px;
    transition: transform 0.2s ease-in-out;
}

.back-button:hover {
    transform: scale(1.1);
}

.box-header h2 {
    color: white;
    font-size: 1.3rem;
    margin: 0;
}

.title-arrow {
    display: none;
}

#brandDeviceGrid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
}

#brandDeviceGrid .device-card,
#deviceSelectorScreen .device-grid .device-card {
    flex: 1 1 auto;
    padding: 20px;
    height: auto;
    justify-content: center;
}

#brandDeviceGrid .device-card span {
    color: #021b3b;
}

#brandDeviceGrid .device-card img {
    width: 80px;
    height: 80px;
}

.no-items-msg {
    text-align: center;
    color: var(--light-text);
    padding: 20px;
    width: 100%;
    grid-column: 1 / -1;
}

/* --- Search Results Styles --- */
#searchResults {
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    z-index: 100;
    max-height: 350px;
    overflow-y: auto;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background-color: #f8f9fa;
}
.search-result-item .device-name {
    font-weight: bold;
}

.search-result-item .service-list {
    list-style-type: none;
    padding-left: 20px;
    margin-top: 4px;
    font-size: 0.9em;
}

.search-result-item .service-list li {
    color: #555;
    position: relative;
    padding-left: 15px;
}

.search-result-item .service-list li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* --- NEW STYLES FOR DEVICE SELECTION SCREEN --- */
#deviceSelectionContainer {
    display: none;
    margin-top: 30px;
}

.breadcrumb-nav {
    display: inline-flex;
    align-items: stretch;
    background-color: #36393f;
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
    margin-bottom: 15px;
}

.breadcrumb-part {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
}

.breadcrumb-part.category {
    cursor: pointer;
    transition: background-color 0.2s;
}

.breadcrumb-part.category:hover {
    background-color: #4f545c;
}

.breadcrumb-separator {
    display: flex;
    align-items: center;
    padding: 0 5px;
    color: #7289da;
    font-size: 1.2rem;
    font-weight: bold;
}

.breadcrumb-part.brand {
    background-color: rgba(255, 255, 255, 0.1);
}

.breadcrumb-part svg {
    width: 20px;
    height: 20px;
}

#deviceSelectorScreen {
    background-color: #ffffff;
    border: 2px solid #1c1e21; 
    border-radius: 12px;
    display: flex; 
    flex-direction: column;
}

.device-selection-header {
    background-color: #1c1e21;
    color: white;
    padding: 20px;
}

.device-selection-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
    text-align: left;
}

#deviceSelectorScreen .device-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

#deviceSelectorScreen .device-card {
    background-color: #fff;
    border: 1px solid #dddfe2;
    width: 100%;
    min-width: 0;
}

.device-selection-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #dddfe2;
    background-color: #ffffff; 
    border-bottom-left-radius: 10px; 
    border-bottom-right-radius: 10px;
}

#deviceBackBtn {
    margin: 0 auto;
    display: block;
    background-color: #fff;
    color: #1c1e21;
    font-weight: bold;
    border: 1px solid #dddfe2;
    min-width: 150px;
}

#deviceBackBtn:hover {
    background-color: #f0f2f5;
}

/* --- UPDATED: Auto-fit devices to fill width --- */
.device-group {
    width: 100%;
    margin: 3px 0;
    border: none;
    border-radius: 0;
    background-color: transparent;
    grid-column: 1 / -1;
}

.device-group h3 {
    background-color: transparent;
    margin: 0 0 8px 0;
    padding: 0;
    border: none;
    font-size: 1.1em;
    color: #0078fb;
    text-align: left;
    font-weight: 600;
}

.device-group .device-list {
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    background-color: transparent;
}

.device-group .device-list .device-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 0;
}

/* Devices without group - also displayed in grid */
#deviceSelectorScreen .device-grid > .device-card {
    width: 100%;
    min-width: 0;
}


/* --- RESPONSIVE STYLES --- */
@media (max-width: 767px) {
    /* Category Grid - 2 columns on mobile */
    #categoryGrid.device-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
        padding: 0 15px 15px 15px;
    }
    
    /* If odd number of items, last item stretches full width */
    #categoryGrid .device-card:last-child:nth-child(odd) {
        grid-column: 1 / -1 !important;
    }
    
    /* Category cards - bigger icons on mobile */
    #categoryGrid .device-card {
        padding: 20px 15px;
    }
    
    #categoryGrid .device-card img {
        width: 88px;
        height: 88px;
        margin-bottom: 12px;
    }
    
    #categoryGrid .device-card span {
        font-size: 0.95rem;
    }
    
    #deviceSelectorScreen {
        padding-bottom: 80px; 
    }
    
    /* Device grid - 2 columns with stretch */
    #deviceSelectorScreen .device-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
        padding: 15px;
    }
    
    /* Device groups - 2 columns with stretch */
    .device-group .device-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    /* Remove flex-basis that was preventing stretch */
    #brandDeviceGrid .device-card,
    #deviceSelectorScreen .device-grid .device-card,
    .device-group .device-list .device-card {
        flex-basis: auto !important;
        width: 100% !important;
    }
    
    /* UPDATED: Device icons 15% bigger on mobile - "Please Select Your Device" section */
    #deviceSelectorScreen .device-card img,
    .device-group .device-list .device-card img {
        width: 80.5px;  /* 70px * 1.15 = 80.5px */
        height: 80.5px;
    }
    
    .device-selection-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 100;
        background-color: var(--white);
        padding: 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        border-radius: 0;
        display: flex;
    }
    
    #deviceBackBtn {
        flex: 1;
        margin: 0;
        position: relative;
        height: 60px;
        font-size: 1.1rem;
        border-radius: 0;
        border: none;
        padding-left: 30px;
        background-color: #000000;
        color: var(--white);
    }

    #deviceBackBtn::before {
        content: '';
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 15px;
        width: 24px;
        height: 24px;
        background-color: white;
        -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>');
        mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>');
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-position: center;
        mask-position: center;
    }

    .box-header h2 {
        font-size: 1.1rem;
    }
    
    .device-card img {
        width: 70px;
        height: 70px;
    }
    
    .device-card span {
        font-size: 0.9rem;
    }
}

/* Tablet - 3 columns */
@media (min-width: 768px) and (max-width: 1023px) {
    #deviceSelectorScreen .device-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .device-group .device-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- DESKTOP-SPECIFIC LAYOUTS --- */
@media (min-width: 1024px) {
    #categoryGrid.device-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 25px;
    }
    #categoryGrid .device-card {
        padding: 30px 20px;
    }
    #categoryGrid .device-card img {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }
    #categoryGrid .device-card span {
        font-size: 1.1rem;
    }

    #brandDeviceGrid .device-card,
    #deviceSelectorScreen .device-grid .device-card {
        flex-basis: calc(20% - 16px);
    }
    
    #deviceSelectorScreen .device-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .device-group .device-list {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}