/* ===============================
   ACCOUNT NAVIGATION STYLES
   =============================== */

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.account-nav {
    position: relative;
}

.auth-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.auth-link {
    color: #333;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.auth-link:hover {
    background: linear-gradient(135deg, #C77398, #E3A5C7);
    color: white;
    text-decoration: none;
}

.user-menu {
    position: relative;
    z-index: 1000; /* Establish stacking context for entire menu */
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 2px solid #E3A5C7;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    position: relative;
    z-index: 2; /* Relative to parent menu */
    pointer-events: auto;
}

.user-menu-toggle:hover {
    background: linear-gradient(135deg, #C77398, #E3A5C7);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(199, 115, 152, 0.3);
}

.user-menu-toggle i:last-child {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    transform-origin: center; /* Ensure rotation doesn't affect stacking context */
    will-change: transform; /* Optimize animation performance */
}

.user-menu.active .user-menu-toggle i:last-child {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border: 1px solid #E3A5C7;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    display: none; /* Use display: none for initial hidden state */
    transition: all 0.3s ease;
    z-index: 3; /* Relative to parent menu, higher than toggle */
    isolation: isolate; /* Create isolated stacking context */
}

.user-menu.active .user-dropdown {
    display: block; /* Use display: block to show */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu:not(.active) .user-dropdown {
    display: none; /* Ensure it hides when not active */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.user-dropdown a:hover {
    background: linear-gradient(135deg, #F6F5F2, #E3A5C7);
    color: #C77398;
    padding-left: 1.5rem;
}

.dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0.5rem 0;
}

.user-dropdown i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    color: #E3A5C7;
}

/* Floating dropdown styles (for main pages) */
#floating-user-dropdown {
    position: fixed;
    background: white;
    border: 1px solid #E3A5C7;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 99999;
    display: none;
    transition: all 0.3s ease;
    isolation: isolate;
}

#floating-user-dropdown.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

#floating-user-dropdown:not(.show) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
}

#floating-user-dropdown a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #8B5A2B;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
    font-weight: 500;
}

#floating-user-dropdown a:hover {
    background: linear-gradient(135deg, #F8E8EF 0%, #E8D8F5 100%);
    color: #D4627A;
    transform: translateX(4px);
}

#floating-user-dropdown a:last-child {
    border-bottom: none;
    border-radius: 0 0 10px 10px;
}

#floating-user-dropdown a:first-child {
    border-radius: 10px 10px 0 0;
}

#floating-user-dropdown i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    color: #E3A5C7;
}

/* ===============================
   ACCOUNT PAGES STYLES
   =============================== */

.account-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 140px);
}

.account-header {
    text-align: center;
    margin-bottom: 3rem;
}

.account-header h1 {
    color: #C77398;
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.account-header p {
    color: #666;
    font-size: 1.1rem;
}

.auth-form-container {
    max-width: 450px;
    margin: 0 auto;
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-input {
    padding: 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-input:focus {
    outline: none;
    border-color: #C77398;
    background: white;
    box-shadow: 0 0 0 3px rgba(199, 115, 152, 0.1);
}

.form-input.error {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.success-message {
    color: #27ae60;
    font-size: 0.9rem;
    padding: 1rem;
    background: #d5f4e6;
    border: 1px solid #27ae60;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.btn-auth {
    background: linear-gradient(135deg, #C77398, #E3A5C7);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(199, 115, 152, 0.3);
}

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-links-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #E0E0E0;
}

.auth-links-bottom a {
    color: #C77398;
    text-decoration: none;
    font-weight: 500;
}

.auth-links-bottom a:hover {
    text-decoration: underline;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #C77398;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===============================
   DASHBOARD STYLES
   =============================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.dashboard-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.dashboard-card h3 {
    color: #C77398;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-card .card-icon {
    font-size: 1.5rem;
    color: #E3A5C7;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #C77398;
    margin: 0.5rem 0;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}

.quick-action-btn {
    background: linear-gradient(135deg, #C77398, #E3A5C7);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(199, 115, 152, 0.3);
    color: white;
    text-decoration: none;
}

/* ===============================
   ORDER HISTORY STYLES
   =============================== */

.order-filters {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
}

.order-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.order-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.order-number {
    font-size: 1.1rem;
    font-weight: bold;
    color: #C77398;
}

.order-date {
    color: #666;
    font-size: 0.9rem;
}

.order-status {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-processing {
    background: #cce5ff;
    color: #004085;
}

.status-completed {
    background: #d1e7dd;
    color: #0f5132;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.order-items {
    margin: 1rem 0;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.order-item:last-child {
    border-bottom: none;
}

.item-name {
    font-weight: 500;
}

.item-quantity {
    color: #666;
    font-size: 0.9rem;
}

.item-price {
    font-weight: bold;
    color: #C77398;
}

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #E3A5C7;
    font-size: 1.2rem;
    font-weight: bold;
}

/* ===============================
   FAVORITES STYLES
   =============================== */

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.favorite-item {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.favorite-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.favorite-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.favorite-content {
    padding: 1.5rem;
}

.favorite-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.favorite-price {
    color: #C77398;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.favorite-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-favorite {
    background: linear-gradient(135deg, #C77398, #E3A5C7);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-remove-favorite {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-remove-favorite:hover {
    background: #e74c3c;
}

/* Responsive styles */
@media (max-width: 768px) {
    .auth-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .user-menu-toggle {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .user-dropdown {
        right: -20px;
        min-width: 200px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .order-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .order-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .quick-actions {
        justify-content: center;
    }
}
