/* User Dropdown & Cart Component Styles - แก้ไขไม่ให้ conflict กับ login page */

/* User and Cart Styles */
.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-dropdown {
    position: relative;
}

.user-button, .cart-button {
    background: rgba(255, 255, 255, 0.9);
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1.4rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.user-button {
    width: auto;
    padding: 10px 12px;
    gap: 4px;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.user-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-button:hover, .cart-button:hover {
    background: rgba(255, 140, 66, 0.1);
    border-color: rgba(255, 140, 66, 0.3);
    color: #ff8c42;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 140, 66, 0.15);
}

.user-button.logged-in {
    background: rgba(39, 174, 96, 0.1);
    border-color: rgba(39, 174, 96, 0.3);
    color: #27ae60;
}

.user-button.logged-in:hover {
    background: rgba(39, 174, 96, 0.15);
    border-color: rgba(39, 174, 96, 0.4);
    color: #27ae60;
    box-shadow: 0 4px 16px rgba(39, 174, 96, 0.15);
}

/* แก้ไข: เฉพาะใน header เท่านั้น ไม่ให้ affect login page */
.header .user-button.active {
    background: rgba(255, 140, 66, 0.15);
    border-color: rgba(255, 140, 66, 0.4);
    color: #ff8c42;
}

/* Cart Count Badge */
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* User Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #ff8c42, #ffa726);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(255, 140, 66, 0.05);
    color: #ff8c42;
    padding-left: 1.5rem;
}

.dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.dropdown-item:hover svg {
    opacity: 1;
}

/* Arrow pointing up to button */
.user-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 2000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cart-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: auto;
    color: #666;
    transition: color 0.3s;
}

.cart-close:hover {
    color: #ff8c42;
}

.cart-content {
    padding: 1rem;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.cart-item-info {
    flex: 1;
    margin-left: 1rem;
}

.cart-item-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.cart-item-price {
    color: #ff8c42;
    font-weight: bold;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.qty-btn {
    background: #f0f0f0;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.qty-btn:hover {
    background: #e0e0e0;
}

.cart-total {
    padding: 1rem;
    border-top: 2px solid #eee;
    text-align: center;
}

.total-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff8c42;
    margin-bottom: 1rem;
}

.checkout-btn {
    background: #ff8c42;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    width: 100%;
    transition: background 0.3s;
}

.checkout-btn:hover {
    background: #e67e22;
}

/* Add to Cart Button */
.add-to-cart-btn {
    background: #ff8c42;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 1rem;
    transition: background 0.3s;
}

.add-to-cart-btn:hover {
    background: #e67e22;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .user-section {
        gap: 0.5rem;
    }
    
    .user-button, .cart-button {
        width: 44px;
        height: 44px;
        padding: 8px;
    }
    
    .user-button {
        width: auto;
        padding: 8px 10px;
        gap: 3px;
    }
    
    .user-button svg, .cart-button svg {
        width: 20px;
        height: 20px;
    }
    
    .dropdown-arrow {
        width: 10px;
        height: 10px;
    }
    
    .user-dropdown-menu {
        min-width: 180px;
        right: -10px;
    }
    
    .user-dropdown-menu::before {
        right: 25px;
    }
    
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 480px) {
    .user-dropdown-menu {
        min-width: 160px;
        right: -20px;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}