/* Custom Package Builder Styles */

/* ========================================
   LAYOUT
   ======================================== */

.custom-package-builder {
    width: 100%;
}

.builder-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
    align-items: start;
}

/* ========================================
   CATEGORY FILTERS
   ======================================== */

.category-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.category-btn {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    font-family: inherit;
}

.category-btn i {
    font-size: 16px;
    flex-shrink: 0;
}

.category-btn:hover {
    border-color: #000;
    background: #f9f9f9;
    color: #000;
    transform: translateY(-2px);
}

.category-btn.active {
    background: #000;
    border-color: #000;
    color: #fff;
}

/* ========================================
   ITEMS SECTION
   ======================================== */

.items-section {
    width: 100%;
}

.section-header {
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #000;
}

.section-header p {
    font-size: 16px;
    color: #666;
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Item Card */
.item-card {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.item-card:hover {
    border-color: #000;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.item-card.selected {
    border-color: #22c55e;
    background: #f0fdf4;
}

.item-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f0f0f0;
}

.item-info {
    padding: 20px;
}

.item-info h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #000;
    line-height: 1.3;
}

.item-price {
    font-size: 22px;
    font-weight: 800;
    color: #000;
    margin-bottom: 16px;
    display: block;
}

.btn-select {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-select:not(.selected) {
    background: #000;
    color: #fff;
}

.btn-select.selected {
    background: #22c55e;
    color: #fff;
}

.btn-select:hover {
    transform: translateY(-2px);
}

.btn-select i {
    font-size: 18px;
}

/* ========================================
   SUMMARY SIDEBAR
   ======================================== */

.summary-sidebar {
    position: sticky;
    top: 100px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.sidebar-header h3 {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    color: #000;
}

/* Summary Stats */
.summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    text-align: center;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 12px;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: #000;
}

/* Selected Items Container */
.selected-items-container {
    margin-bottom: 24px;
}

.selected-items-container h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #000;
}

#selectedItemsList {
    max-height: 300px;
    overflow-y: auto;
}

#selectedItemsList::-webkit-scrollbar { width: 6px; }
#selectedItemsList::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 3px; }
#selectedItemsList::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
#selectedItemsList::-webkit-scrollbar-thumb:hover { background: #999; }

.no-items {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
    font-size: 14px;
}

/* Selected Item */
.selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.selected-item:hover { background: #f0f0f0; }

.selected-item span:first-child {
    flex: 1;
    font-weight: 500;
    color: #000;
    font-size: 14px;
    padding-right: 12px;
}

.selected-item .item-price {
    font-weight: 700;
    color: #000;
    margin: 0 12px 0 0;
    font-size: 15px;
}

.btn-remove {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.btn-remove:hover { background: #fee2e2; color: #991b1b; }

/* Proceed Button */
.btn-proceed {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    margin-bottom: 16px;
}

.btn-proceed i { font-size: 20px; }

/* Back Link */
.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    padding: 12px;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.back-link:hover { background: #f9f9f9; color: #000; }

/* ========================================
   LOADING STATE
   ======================================== */

.loading-state { grid-column: 1 / -1; }

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .builder-layout {
        grid-template-columns: 1fr 320px;
        gap: 30px;
    }
}

@media (max-width: 992px) {
    .builder-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .summary-sidebar {
        position: relative;
        top: 0;
        order: -1;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    /* Category filters: wrap into a clean 3-per-row grid */
    .category-filters {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        text-align: center;
    }

    .category-btn {
        padding: 10px 8px;
        font-size: 13px;
        justify-content: center;
        gap: 5px;
        /* Keep full text — no hiding */
    }

    .category-btn i {
        font-size: 14px;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .item-card img {
        height: 140px;
    }

    .item-info {
        padding: 14px;
    }

    .item-info h3 {
        font-size: 15px;
    }

    .item-price {
        font-size: 18px;
    }

    .summary-sidebar {
        padding: 20px;
    }

    .summary-stats {
        gap: 12px;
    }

    .stat {
        padding: 12px;
    }

    .stat-value {
        font-size: 22px;
    }

    .section-header h2 {
        font-size: 26px;
    }
}

@media (max-width: 480px) {
    /* On very small screens, drop to 2 columns for category buttons */
    .category-filters {
        grid-template-columns: repeat(2, 1fr);
    }

    .items-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .item-card img {
        height: 120px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .navbar,
    .category-filters,
    .summary-sidebar,
    .site-footer,
    #backToTop { display: none; }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    .item-card,
    .summary-sidebar,
    .category-btn { border-width: 3px; }
}