/* 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.85);
    color: #475569;
    border: 1.5px solid rgba(226, 232, 240, 0.8);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    font-size: 1.4rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    outline: none;
}

.user-button {
    width: auto;
    padding: 10px 16px;
    gap: 8px;
}

.dropdown-arrow {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
}

.user-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-button:hover, .cart-button:hover {
    background: rgba(79, 209, 139, 0.08);
    border-color: rgba(79, 209, 139, 0.3);
    color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 209, 139, 0.15);
}

.user-button:focus, .cart-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 209, 139, 0.25), 0 4px 12px rgba(15, 23, 42, 0.04);
}

.user-button.logged-in {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.05) 0%, rgba(46, 204, 113, 0.08) 100%);
    border: 1.5px solid rgba(39, 174, 96, 0.25);
    color: #27ae60;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.user-button.logged-in:hover {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.09) 0%, rgba(46, 204, 113, 0.14) 100%);
    border-color: rgba(39, 174, 96, 0.45);
    color: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(39, 174, 96, 0.15);
}

.user-button i.fa-user-cog, 
.user-button svg {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-button:hover i.fa-user-cog {
    transform: rotate(45deg);
}

.user-button:hover svg {
    transform: scale(1.08);
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: inherit;
}

/* แก้ไข: เฉพาะใน header เท่านั้น ไม่ให้ affect login page */
.header .user-button.active {
    background: rgba(79, 209, 139, 0.12);
    border-color: rgba(79, 209, 139, 0.4);
    color: #2e7d32;
    box-shadow: 0 8px 24px rgba(79, 209, 139, 0.15);
}

/* 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, #4fd18b, #3ab776);
    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(79, 209, 139, 0.05);
    color: #4fd18b;
    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: #f5f9f5;
}

.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: #4fd18b;
}

.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: #4fd18b;
    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: #4fd18b;
    margin-bottom: 1rem;
}

.checkout-btn {
    background: #4fd18b;
    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: #3ab776;
}

/* Add to Cart Button */
.add-to-cart-btn {
    background: #4fd18b;
    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: #3ab776;
}

/* 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;
    }
}

/* ========================
   MODERN LOGOUT CONFIRM MODAL
   ======================== */
.hamonic-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.hamonic-confirm-overlay.active {
    opacity: 1;
}

.hamonic-confirm-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 32px 28px;
    width: calc(100% - 32px);
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    text-align: center;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hamonic-confirm-overlay.active .hamonic-confirm-card {
    transform: translateY(0) scale(1);
}

.hamonic-confirm-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.05));
    animation: pulseIcon 2s infinite ease-in-out;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.hamonic-confirm-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    font-family: inherit;
}

.hamonic-confirm-message {
    font-size: 15px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 28px;
}

.hamonic-confirm-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
}

.hamonic-confirm-btn {
    padding: 12px 26px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hamonic-confirm-btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.hamonic-confirm-btn-cancel:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: translateY(-1px);
}

.hamonic-confirm-btn-confirm {
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: white;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
}

.hamonic-confirm-btn-confirm:hover {
    background: linear-gradient(135deg, #be123c, #9f1239);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(225, 29, 72, 0.3);
}

.hamonic-confirm-btn:active {
    transform: translateY(0);
}

/* Dark mode for Confirm Modal */
@media (prefers-color-scheme: dark) {
    .hamonic-confirm-overlay {
        background: rgba(15, 23, 42, 0.6);
    }
    .hamonic-confirm-card {
        background: rgba(30, 41, 59, 0.9);
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    }
    .hamonic-confirm-title {
        color: #f8fafc;
    }
    .hamonic-confirm-message {
        color: #94a3b8;
    }
    .hamonic-confirm-btn-cancel {
        background: #334155;
        color: #cbd5e1;
        border-color: #475569;
    }
    .hamonic-confirm-btn-cancel:hover {
        background: #475569;
        color: #f8fafc;
    }
}