/* * Alpha Compare Design (Final Version)
 * Features: No Sticky Columns, Keyboard Fix, Modern UI
 */

/* =========================================
   1. FLOATING BUTTON
   ========================================= */
.alpha-floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #d63638;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(214, 54, 56, 0.4);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.alpha-floating-btn.hidden { display: none !important; }
.alpha-floating-btn.bump { transform: scale(1.1); }
.floating-icon { font-size: 24px; }
.floating-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #333;
    color: white;
    font-size: 11px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    font-weight: bold;
}

/* =========================================
   2. COMPARE TRAY (BOTTOM SHEET)
   ========================================= */
.compare-tray {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.15);
    z-index: 10000;
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}
.compare-tray.active { transform: translateY(0); }

/* --- KEYBOARD FIX: LIFT TRAY ON MOBILE --- */
@media (max-width: 768px) {
    .compare-tray.keyboard-up {
        bottom: auto !important;
        top: 60px !important;  /* কিবোর্ডের উপরে নিয়ে যাবে */
        transform: translateY(0) !important;
        transition: top 0.3s ease;
        box-shadow: 0 10px 40px rgba(0,0,0,0.3);
        border-radius: 16px; /* সব কোনা গোল হবে */
    }
}

.tray-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
}

/* Header */
.tray-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}
.tray-title { font-weight: 700; color: #222; font-size: 15px; }
#minimize-tray {
    background: none; border: none; font-size: 20px; cursor: pointer; color: #888;
    padding: 0 10px;
}

/* Items List */
.tray-items {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding: 5px 0;
}
.tray-item {
    position: relative;
    width: 65px;
    height: 65px;
    flex-shrink: 0;
}
.tray-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
}
.remove-cmp-item {
    position: absolute;
    top: -6px; right: -6px;
    background: #ff4757; color: white;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 22px; height: 22px;
    font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* =========================================
   3. MODERN SEARCH UI
   ========================================= */
.tray-search-wrapper {
    position: relative;
    padding: 5px 0 10px 0;
    margin-bottom: 10px;
    animation: fadeIn 0.3s;
}

/* Input Field */
#alpha-tray-search {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background-color: #f9f9f9;
    transition: all 0.2s;
    box-sizing: border-box;
}
#alpha-tray-search:focus {
    border-color: #d63638;
    background-color: #fff;
    box-shadow: 0 3px 10px rgba(214, 54, 56, 0.1);
}

/* Close Icon */
#close-tray-search {
    position: absolute;
    right: 12px;
    top: 15px;
    background: none;
    border: none;
    font-size: 20px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

/* Search Results (Scrollable) */
.tray-search-results {
    margin-top: 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}
.tray-search-results::-webkit-scrollbar { width: 5px; }
.tray-search-results::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Result Item */
.tray-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.1s;
}
.tray-search-item:hover { background: #fff0f0; }
.tray-search-item img {
    width: 35px; height: 35px; object-fit: cover; border-radius: 4px;
}
.tray-search-item span { font-size: 13px; font-weight: 500; color: #333; }

/* =========================================
   4. ACTIONS & BUTTONS
   ========================================= */
.tray-actions { display: flex; gap: 10px; }

.compare-now-btn {
    flex: 1;
    background: #d63638;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(214, 54, 56, 0.3);
}
.compare-now-btn:disabled { background: #ddd; color: #888; box-shadow: none; cursor: not-allowed; }

.clear-btn {
    background: #f1f2f6; color: #555;
    border: none; padding: 0 20px;
    border-radius: 30px; cursor: pointer; font-weight: 600;
}

.add-more-btn {
    background: #fff;
    color: #d63638;
    border: 1px dashed #d63638;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
}
.add-more-btn:hover { background: #fff5f5; }

/* =========================================
   5. TOAST NOTIFICATION
   ========================================= */
.alpha-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 10001;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.alpha-toast.show { opacity: 1; }

/* =========================================
   6. MODAL & TABLE (NORMAL SCROLL - NO STICKY)
   ========================================= */
.alpha-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 11000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    width: 95%;
    max-width: 1000px;
    height: 90vh; 
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.close-modal {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 30px;
    cursor: pointer;
    z-index: 20;
    color: #333;
    background: white;
    border-radius: 50%;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
}

#compare-results-body {
    flex: 1;
    overflow: hidden; 
    display: flex;
    flex-direction: column;
}

/* --- NORMAL TABLE LOGIC --- */
.compare-scroll-wrapper {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
}

.compare-table {
    border-collapse: collapse; /* Normal collapse */
    width: 100%;
    font-size: 13px;
}

.compare-table th, .compare-table td {
    padding: 10px 8px;
    border: 1px solid #eee;
    text-align: center;
    vertical-align: middle;
    background: #fff;
    min-width: 140px;
    max-width: 180px;
}

/* First Column (Labels like RAM, Camera) - NO STICKY */
.compare-table tr th:first-child,
.compare-table tr td:first-child {
    background: #f8f9fa;
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    text-align: left;
    font-weight: 600;
    color: #444;
    padding-left: 10px;
}

/* Header Row Specifics */
.product-header img {
    width: 60px; height: auto; 
    margin: 0 auto 8px; 
    display: block;
}
.product-header h3 {
    font-size: 14px; margin: 0; line-height: 1.3; color: #222;
}
.cmp-price {
    font-size: 12px; color: #d63638; font-weight: 700; margin-top: 5px;
}

/* Winner Highlight */
.winner-cell {
    background-color: #f0fff4 !important;
    color: #006c5f;
    font-weight: 600;
}
.win-icon { font-size: 14px; margin-left: 5px; }

/* Mobile Adjustments */
@media (max-width: 600px) {
    .modal-content {
        width: 100%; height: 100%; border-radius: 0;
    }
    .compare-table { font-size: 12px; }
    .product-header img { width: 50px; }
    .compare-table th, .compare-table td { padding: 8px 5px; }
    
    .compare-table tr th:first-child,
    .compare-table tr td:first-child {
        min-width: 90px;
        max-width: 90px;
        font-size: 11px;
    }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }