/* User Modals Styles */

.modal-user {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-user.active {
    display: flex;
    opacity: 1;
}

.modal-user-content {
    background: white;
    width: 90%;
    max-width: 800px; /* Wider for orders */
    max-height: 90vh;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 0;
}

.modal-user.active .modal-user-content {
    transform: translateY(0);
}

.modal-user-header {
    padding: 24px 32px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-user-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.modal-user-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-user-close:hover {
    background: #f5f5f5;
    color: var(--text-main);
}

.modal-user-body {
    padding: 32px;
}

/* Order Stepper */
.order-stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.order-stepper::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.step-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.step-dot {
    width: 30px;
    height: 30px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.step-dot i {
    font-size: 0.8rem;
    color: transparent;
    transition: color 0.3s;
}

.step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

/* Active/Completed Steps */
.step-item.completed .step-dot {
    background: var(--success);
    border-color: var(--success);
}

.step-item.completed .step-dot i {
    color: white;
}

.step-item.active .step-dot {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(44, 95, 45, 0.1);
}

.step-item.active .step-dot i {
    color: var(--primary-color);
}

.step-item.completed .step-label,
.step-item.active .step-label {
    color: var(--text-main);
}

/* Progress Line Fill */
.progress-line-fill {
    position: absolute;
    top: 14px;
    left: 10%;
    height: 2px;
    background: var(--success);
    z-index: 0;
    width: 0%; /* Dynamic via JS - percentage of the 80% track */
    transition: width 0.5s ease;
}

/* Order Details Grid */
.order-details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

.order-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.order-products-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-product-item {
    display: flex;
    gap: 16px;
    align-items: center;
}

.order-product-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: #f9f9f9;
    object-fit: cover;
}

.order-product-info {
    flex: 1;
}

.order-product-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 4px;
}

.order-product-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.order-product-price {
    font-weight: 700;
    color: var(--text-main);
}

/* Order Summary Sidebar */
.order-summary-box {
    background: #f9f9f9;
    padding: 24px;
    border-radius: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.summary-row.total {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 0;
}

.delivery-method {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.delivery-time {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--success);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Profile Form */
.profile-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
}

.btn-save {
    grid-column: span 2;
    margin-top: 16px;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save:hover {
    background: var(--primary-dark);
}

/* ==========================================
   User Dropdown Menu
   ========================================== */

.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-auth-header {
    padding: 8px 0;
}

.dropdown-auth-header .dropdown-item.login-btn {
    background: var(--primary-color);
    color: white !important;
    margin: 8px 12px;
    border-radius: 8px;
    justify-content: center;
    font-weight: 600;
}

.dropdown-auth-header .dropdown-item.login-btn:hover {
    background: var(--primary-dark);
}

.dropdown-auth-header .dropdown-item.login-btn i {
    color: white !important;
}

.dropdown-auth-header .dropdown-item.register-btn {
    margin: 0 12px 8px;
    border-radius: 8px;
    justify-content: center;
    border: 1px solid #e0e0e0;
}

.dropdown-auth-header .dropdown-item.register-btn:hover {
    background: #f5f5f5;
    border-color: var(--primary-color);
}

.dropdown-user-info {
    padding: 16px 20px;
    background: #f9f9f9;
}

.dropdown-user-name {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.dropdown-user-email {
    display: block;
    font-size: 13px;
    color: #888;
}

.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 14px;
}

.user-dropdown .dropdown-item:hover {
    background: #f5f5f5;
}

.user-dropdown .dropdown-item i {
    width: 20px;
    text-align: center;
    color: #888;
}

.user-dropdown .dropdown-item.logout {
    color: #d32f2f;
    border-top: 1px solid #f0f0f0;
}

.user-dropdown .dropdown-item.logout i {
    color: #d32f2f;
}

.user-dropdown .dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0;
}

/* Profile Icon Styles - for logged in users */
.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    background: linear-gradient(135deg, rgba(44, 95, 45, 0.15) 0%, rgba(44, 95, 45, 0.08) 100%);
    border: 1px solid rgba(44, 95, 45, 0.2);
}

/* Orders List View */
.modal-orders-content {
    max-width: 900px;
}

.orders-loading,
.orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
    gap: 16px;
}

.orders-loading i,
.orders-empty i {
    font-size: 3rem;
    color: var(--primary-color);
    opacity: 0.5;
}

.orders-empty p {
    font-size: 1.1rem;
    margin: 0;
}

/* Guest Upgrade View */
.guest-upgrade {
    padding: 40px 20px;
}

.guest-upgrade h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.guest-upgrade i.fa-user-plus {
    font-size: 3rem;
    color: var(--primary-color);
    opacity: 0.8;
}

.guest-email {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 12px 0;
}

.guest-email strong {
    color: var(--primary-color);
}

.btn-upgrade-account {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #2C5F2D 0%, #3d7a3e 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(44, 95, 45, 0.3);
    margin: 16px 0;
}

.btn-upgrade-account:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 95, 45, 0.4);
}

.guest-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Guest Upgrade Form */
.guest-upgrade-form {
    padding: 30px;
    max-width: 380px;
    margin: 0 auto;
}

.upgrade-header {
    text-align: center;
    margin-bottom: 28px;
}

.upgrade-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    display: block;
}

.upgrade-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 600;
}

.upgrade-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.upgrade-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.upgrade-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upgrade-form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.upgrade-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: #fafafa;
}

.upgrade-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(44, 95, 45, 0.1);
}

.upgrade-input.readonly {
    background: #f0f0f0;
    color: #666;
    cursor: not-allowed;
}

.upgrade-error {
    color: #d32f2f;
    font-size: 0.9rem;
    text-align: center;
    min-height: 20px;
}

.btn-upgrade-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #2C5F2D 0%, #3d7a3e 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(44, 95, 45, 0.25);
    margin-top: 8px;
}

.btn-upgrade-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 95, 45, 0.35);
}

.btn-upgrade-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-back-guest {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 12px;
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    width: 100%;
    transition: all 0.2s ease;
}

.btn-back-guest:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(44, 95, 45, 0.05);
}

/* Email Verification View */
.verify-email i.fa-envelope {
    font-size: 3rem;
    color: #ff9800;
    opacity: 0.9;
}

.btn-resend-verification {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    margin: 16px 0;
}

.btn-resend-verification:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.btn-resend-verification:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none;
}

.btn-shop {
    display: inline-block;
    padding: 12px 28px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-shop:hover {
    background: var(--primary-dark);
}

/* Orders List */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.order-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #e8e8e8;
}

.order-number-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
}

.order-number-value {
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.1rem;
}

.order-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-pending {
    background: #fff3e0;
    color: #e65100;
}

.status-paid {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-processing {
    background: #e3f2fd;
    color: #1565c0;
}

.status-shipped {
    background: #e1f5fe;
    color: #0277bd;
}

.status-delivered {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-cancelled {
    background: #ffebee;
    color: #c62828;
}

.status-refunded {
    background: #fce4ec;
    color: #ad1457;
}

.order-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
}

.order-info {
    display: flex;
    gap: 24px;
}

.order-date,
.order-items-count {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.order-date i,
.order-items-count i {
    color: var(--primary-color);
    opacity: 0.7;
}

.order-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
}

.order-card-footer {
    padding: 12px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.btn-order-details {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-order-details:hover {
    background: var(--primary-dark);
}

/* Back Button */
.btn-back-orders {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.btn-back-orders:hover {
    background: #f0f0f0;
    color: var(--text-main);
}

.modal-user-title {
    display: flex;
    align-items: center;
}

/* Delay Warning */
.order-delay-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #fff8e1;
    color: #f57f17;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid #ffecb3;
}

.order-delay-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: #fff8e1;
    border-radius: 12px;
    margin-bottom: 24px;
    color: #f57f17;
}

.order-delay-banner i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.order-delay-banner strong {
    display: block;
    margin-bottom: 4px;
}

.order-delay-banner p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.delivery-time.delayed {
    color: #f57f17 !important;
}

/* Delivery Address */
.delivery-address {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.delivery-address p {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Tracking Info */
.tracking-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.tracking-info p {
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--text-main);
    background: #e8f5e9;
    padding: 8px 12px;
    border-radius: 6px;
}

.btn-track {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-track:hover {
    background: var(--primary-dark);
}

/* Cancel Order Button */
.btn-cancel-order {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background: transparent;
    color: #c62828;
    border: 1px solid #c62828;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-order:hover {
    background: #c62828;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .order-details-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-form {
        grid-template-columns: 1fr;
    }
    
    .form-group.full-width {
        grid-column: span 1;
    }
    
    .btn-save {
        grid-column: span 1;
    }
    
    .step-label {
        font-size: 0.7rem;
    }
    
    .user-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 20px 20px 0 0;
        min-width: 100%;
        transform: translateY(100%);
    }
    
    .user-dropdown.active {
        transform: translateY(0);
    }
    
    /* Orders list responsive */
    .order-card-body {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .order-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .order-total {
        align-self: flex-end;
    }
    
    .order-stepper {
        overflow-x: auto;
        padding-bottom: 10px;
    }
    
    .step-item {
        min-width: 60px;
    }
}

