/* Profile Page Styles */

.profile-section {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
    background-color: var(--bg-light);
}

.profile-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

/* Sidebar */
.profile-sidebar {
    background-color: var(--white);
    border-radius: 12px;
    padding: 2rem;
    height: fit-content;
    position: sticky;
    top: 100px;
    box-shadow: var(--shadow-md);
}

.profile-card {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 3rem;
}

.profile-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.profile-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.profile-menu {
    display: flex;
    flex-direction: column;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    position: relative;
}

.menu-item:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.menu-item.active {
    background-color: var(--primary-color);
    color: var(--white);
}

.menu-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.menu-item .badge {
    margin-left: auto;
    background-color: var(--danger-color);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.menu-item.active .badge {
    background-color: var(--white);
    color: var(--primary-color);
}

.logout-btn {
    color: var(--danger-color) !important;
    margin-top: 1rem;
    border-top: 2px solid var(--border-color);
    padding-top: 1.5rem;
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

/* Main Content */
.profile-content {
    background-color: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    color: var(--text-dark);
}

.section-header i {
    color: var(--primary-color);
}

/* Profile Form */
.profile-form-card {
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: 2rem;
}

/* Loading and Empty States */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.spinner {
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding: 0.5rem 1.25rem;
    border: 1.5px solid var(--primary-color);
    border-radius: 8px;
    background: transparent;
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.empty-state-add-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.5rem;
}

.modal form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-overlay .spinner {
    border-color: var(--white);
    border-top-color: var(--primary-color);
    width: 60px;
    height: 60px;
}

.loading-overlay p {
    color: var(--white);
    margin-top: 1rem;
    font-size: 1.1rem;
}

/* Order Cards */
.order-card {
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.order-id {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.order-date {
    color: var(--text-light);
    font-size: 0.9rem;
}

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

.status-pending {
    background-color: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
}

.status-processing {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.status-shipped {
    background-color: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.status-delivered {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-cancelled {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.order-body {
    margin-bottom: 1rem;
}

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

.order-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.order-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.order-item-info h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.order-item-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.order-summary {
    background-color: var(--white);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.order-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.order-shipping {
    display: flex;
    gap: 1rem;
}

.order-shipping i {
    color: var(--primary-color);
    margin-top: 0.25rem;
}

.order-footer {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

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

.wishlist-item {
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: 1rem;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.wishlist-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.wishlist-item a {
    text-decoration: none;
    color: inherit;
}

.wishlist-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.wishlist-item-info {
    margin-bottom: 1rem;
}

.wishlist-item-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.wishlist-item-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.in-stock {
    color: #22c55e;
    font-size: 0.9rem;
}

.out-of-stock {
    color: #ef4444;
    font-size: 0.9rem;
}

.remove-wishlist-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.remove-wishlist-btn:hover {
    background-color: var(--danger-color);
    color: var(--white);
    border-color: var(--danger-color);
}

/* Addresses Grid */
.addresses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.address-card {
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.address-card:hover {
    box-shadow: var(--shadow-md);
}

.address-card.default {
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.05);
}

.default-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

.address-header h4 {
    font-size: 1.1rem;
    margin: 0;
}

.address-type {
    background-color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    text-transform: capitalize;
}

.address-body {
    margin-bottom: 1rem;
}

.address-body p {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.address-body i {
    color: var(--primary-color);
    width: 20px;
}

.address-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

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

.btn-secondary {
    background-color: var(--text-light);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--text-dark);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Order Status Group */
.order-status-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-icon {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    color: var(--text-light);
}

.status-paid {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-unpaid {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Order Summary Row */
.order-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--white);
    border-radius: 8px;
}

.order-total-preview {
    font-size: 1.1rem;
}

.order-items-count {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Order Header - clickable */
.order-header {
    cursor: pointer;
    user-select: none;
}

.order-header:hover {
    background-color: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    padding: 0.5rem;
    margin: -0.5rem;
}

/* Order Details - Accordion */
.order-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.order-details h4 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-details-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.order-shipping,
.order-pricing {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.order-shipping h4,
.order-pricing h4 {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
}

.order-shipping p {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.price-row:last-child {
    border-bottom: none;
}

.price-row.total {
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--border-color);
    font-size: 1.1rem;
}

.order-item-total {
    font-weight: 600;
    color: var(--primary-color);
    margin-left: auto;
}

.order-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Phone Input Group (matches checkout style) */
.phone-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.country-code {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    flex-shrink: 0;
}

.phone-input-group input[type="tel"] {
    flex: 1;
    min-width: 0;
}

/* Wider modal for address form with more fields */
@media (min-width: 600px) {
    #addressModal .modal-content {
        max-width: 560px;
    }
}

/* Responsive */
@media (max-width: 968px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        position: static;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .wishlist-grid,
    .addresses-grid {
        grid-template-columns: 1fr;
    }

    .order-footer {
        flex-direction: column;
    }

    .order-details-section {
        grid-template-columns: 1fr;
    }

    .order-status-group {
        flex-wrap: wrap;
    }
}

/* ================================================================
   REVIEW MODAL — Rate & Review from Orders
   ================================================================ */

/* "Rate & Review" button on each order item */
.order-item-review {
    margin-top: 0.5rem;
}

.btn-rate-product {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border: 1.5px solid var(--secondary-color, #f59e0b);
    border-radius: 20px;
    background: transparent;
    color: var(--secondary-color, #f59e0b);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-rate-product:hover {
    background-color: var(--secondary-color, #f59e0b);
    color: var(--white);
}

/* "Edit Review" variant — uses primary (indigo) instead of gold */
.btn-rate-product.btn-rate-edit {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-rate-product.btn-rate-edit:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* "Already reviewed" badge (shown after submission) */
.order-reviewed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #22c55e;
}

.order-reviewed-badge i {
    font-size: 0.9rem;
}

/* Review modal specific overrides */
.review-modal-content {
    max-width: 480px;
}

.review-modal-body {
    padding: 1.5rem;
}

.review-modal-product-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Star picker inside review modal */
.order-star-picker {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.order-star-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    padding: 0;
    line-height: 1;
}

.order-star-btn:hover,
.order-star-btn.selected {
    color: var(--secondary-color, #f59e0b);
}

.order-star-btn:hover {
    transform: scale(1.15);
}

.order-star-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1.25rem;
    min-height: 1.2em;
}

/* Textarea in review modal */
#orderReviewForm textarea {
    height: 100px;
    resize: vertical;
    font-family: inherit;
}

.char-count {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: right;
    margin-top: 0.25rem;
}

.optional {
    font-weight: 400;
    color: var(--text-light);
}

.required {
    color: #ef4444;
}

/* Disable state for submit button */
#submitOrderReviewBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .order-star-btn {
        font-size: 1.6rem;
    }

    .review-modal-body {
        padding: 1rem;
    }
}
