/* ═══════════════════════════════════════════════════════
   DASHBOARD & ACCOUNT PAGES
   File: assets/css/dashboard.css
═══════════════════════════════════════════════════════ */

/* ── Layout ── */
.woocommerce-account {
    background: var(--pm-bg) !important;
}
.woocommerce-account .woocommerce {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 26px !important;
    max-width: var(--pm-max-width) !important;
    margin: 32px auto !important;
    padding: 0 24px !important;
    width: 100% !important;
    float: none !important;
}
.woocommerce-account .woocommerce::before,
.woocommerce-account .woocommerce::after { display: none !important; }

/* Sidebar */
.woocommerce-account .woocommerce-MyAccount-navigation {
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    flex-shrink: 0 !important;
    float: none !important;
    position: sticky !important;
    top: 90px !important;
    z-index: 20 !important;
    background: var(--pm-bg-card) !important;
    border-radius: var(--pm-radius-md) !important;
    border: 1px solid var(--pm-border) !important;
    box-shadow: var(--pm-shadow-sm) !important;
    overflow: hidden !important;
}

/* Content */
.woocommerce-account .woocommerce-MyAccount-content {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    float: none !important;
    width: auto !important;
}

/* ── Profile Block ── */
.customer-profile-block {
    background: linear-gradient(145deg, var(--pm-primary) 0%, var(--pm-accent) 100%);
    padding: 28px 18px 22px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.customer-profile-block::before {
    content: '';
    position: absolute;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    top: -40px; right: -40px;
    pointer-events: none;
}

.avatar-upload-wrap {
    position: relative;
    width: 78px; height: 78px;
    margin: 0 auto 12px;
    cursor: pointer;
}
.avatar-upload-wrap img {
    width: 78px; height: 78px;
    border-radius: 50%; object-fit: cover;
    border: 3px solid rgba(255,255,255,0.55);
    display: block;
}
.avatar-initials {
    width: 78px; height: 78px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.18);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 800; color: #fff;
}
.avatar-upload-btn {
    position: absolute; bottom: 1px; right: 1px;
    width: 26px; height: 26px;
    background: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--pm-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer; border: none;
    transition: transform var(--pm-transition);
}
.avatar-upload-btn:hover { transform: scale(1.18); }
.avatar-upload-btn svg { width: 13px; height: 13px; }
#avatarFileInput { display: none; }

.customer-name  { font-size: 0.95rem; font-weight: 700; color: #fff; margin: 0 0 3px; }
.customer-email { font-size: 0.72rem; color: rgba(255,255,255,0.7); margin: 0; word-break: break-all; }

/* ── Nav Links ── */
.woocommerce-MyAccount-navigation ul { list-style: none; padding: 10px 0; margin: 0; }
.woocommerce-MyAccount-navigation ul li a {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 18px;
    color: var(--pm-text-mid);
    text-decoration: none;
    font-size: 0.875rem; font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--pm-transition);
    font-family: var(--pm-font) !important;
}
.woocommerce-MyAccount-navigation ul li a svg { width: 17px; height: 17px; flex-shrink: 0; }
.woocommerce-MyAccount-navigation ul li a:hover,
.woocommerce-MyAccount-navigation ul li.is-active a,
.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--is-active a {
    background: var(--pm-primary-light);
    color: var(--pm-primary);
    border-left-color: var(--pm-primary);
    font-weight: 700;
}
.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--customer-logout a {
    color: var(--pm-danger);
    border-top: 1px solid var(--pm-border);
    margin-top: 4px;
}
.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--customer-logout a:hover {
    background: var(--pm-danger-bg);
    border-left-color: var(--pm-danger);
}

/* Mobile nav toggle */
.account-mobile-nav-toggle {
    display: none; width: 100%;
    background: var(--pm-primary); color: #fff;
    border: none; padding: 13px 18px;
    border-radius: var(--pm-radius-md);
    font-size: 0.9rem; font-weight: 700;
    cursor: pointer;
    justify-content: space-between; align-items: center;
    margin-bottom: 10px;
    font-family: var(--pm-font) !important;
}

/* ── Welcome Banner ── */
.customer-welcome-banner {
    background: linear-gradient(135deg, var(--pm-primary) 0%, var(--pm-accent) 100%);
    border-radius: var(--pm-radius-md);
    padding: 26px 32px;
    color: #fff;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
    position: relative; overflow: hidden;
}
.customer-welcome-banner::before {
    content: ''; position: absolute;
    right: -50px; top: -50px;
    width: 180px; height: 180px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    pointer-events: none;
}
.welcome-text { position: relative; z-index: 1; }
.customer-welcome-banner h2 {
    font-family: var(--pm-font-display) !important;
    font-size: 1.35rem; font-weight: 800;
    margin: 0 0 5px; color: #fff;
}
.customer-welcome-banner p { font-size: 0.87rem; color: rgba(255,255,255,0.78); margin: 0; }
.banner-emoji { font-size: 50px; line-height: 1; position: relative; z-index: 1; }

/* ── Stat Cards ── */
.customer-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px; margin-bottom: 20px;
}
@media (max-width: 700px) { .customer-stats-row { grid-template-columns: repeat(2,1fr); } }

.stat-card {
    background: var(--pm-bg-card);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
    padding: 18px 16px;
    display: flex; flex-direction: column; gap: 8px;
    box-shadow: var(--pm-shadow-sm);
    transition: box-shadow var(--pm-transition), transform var(--pm-transition);
}
.stat-card:hover { box-shadow: var(--pm-shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--pm-radius-sm);
    display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: #eef2ff; color: var(--pm-primary); }
.stat-icon.purple { background: #f5f3ff; color: var(--pm-accent); }
.stat-icon.green  { background: #dcfce7; color: var(--pm-success); }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-number { font-size: 1.9rem; font-weight: 900; color: var(--pm-text-dark); line-height: 1; font-family: var(--pm-font-display) !important; }
.stat-label  { font-size: 0.71rem; color: var(--pm-text-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Quick Actions ── */
.dashboard-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px; margin-bottom: 20px;
}
@media (max-width: 700px) { .dashboard-actions-grid { grid-template-columns: repeat(2,1fr); } }

.action-card {
    background: var(--pm-bg-card);
    border: 1.5px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
    padding: 22px 14px 18px;
    text-align: center; text-decoration: none;
    color: var(--pm-text-dark);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    box-shadow: var(--pm-shadow-sm);
    transition: all var(--pm-transition);
}
.action-card:hover {
    box-shadow: var(--pm-shadow-md);
    transform: translateY(-3px);
    text-decoration: none;
}
.action-icon {
    width: 56px; height: 56px;
    border-radius: var(--pm-radius-md);
    display: flex; align-items: center; justify-content: center;
    transition: transform var(--pm-transition);
}
.action-card:hover .action-icon { transform: scale(1.1); }
.action-icon svg { width: 26px; height: 26px; }
.action-label { font-size: 0.83rem; font-weight: 700; color: var(--pm-text-dark); }

.action-card.ac-orders   .action-icon { background: #eef2ff; color: var(--pm-primary); }
.action-card.ac-address  .action-icon { background: #dcfce7; color: var(--pm-success); }
.action-card.ac-account  .action-icon { background: #f5f3ff; color: var(--pm-accent); }
.action-card.ac-download .action-icon { background: #fff7ed; color: #ea580c; }
.action-card.ac-payment  .action-icon { background: #ecfeff; color: #0891b2; }
.action-card.ac-support  .action-icon { background: #fdf2f8; color: #db2777; }
.action-card.ac-wishlist .action-icon { background: #fee2e2; color: var(--pm-danger); }

.action-card.ac-orders:hover   { border-color: var(--pm-primary);  background: #eef2ff; }
.action-card.ac-address:hover  { border-color: var(--pm-success);  background: #dcfce7; }
.action-card.ac-account:hover  { border-color: var(--pm-accent);   background: #f5f3ff; }
.action-card.ac-download:hover { border-color: #ea580c; background: #fff7ed; }
.action-card.ac-payment:hover  { border-color: #0891b2; background: #ecfeff; }
.action-card.ac-support:hover  { border-color: #db2777; background: #fdf2f8; }
.action-card.ac-wishlist:hover { border-color: var(--pm-danger);   background: #fee2e2; }

/* ── Section Cards ── */
.customer-section {
    background: var(--pm-bg-card);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
    overflow: hidden; margin-bottom: 20px;
    box-shadow: var(--pm-shadow-sm);
}
.customer-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px; border-bottom: 1px solid var(--pm-border);
}
.customer-section-header h3 {
    font-size: 0.95rem; font-weight: 700;
    color: var(--pm-text-dark); margin: 0;
    display: flex; align-items: center; gap: 8px;
    font-family: var(--pm-font) !important;
}
.customer-section-header h3 svg { width: 17px; height: 17px; color: var(--pm-primary); }
.customer-section-header a { font-size: 0.8rem; color: var(--pm-primary); text-decoration: none; font-weight: 600; }
.customer-section-header a:hover { text-decoration: underline; }

/* ── Orders Table ── */
table.woocommerce-orders-table, .customer-section-body table.shop_table {
    width: 100%; border-collapse: collapse; font-size: 0.84rem;
    font-family: var(--pm-font) !important;
}
table.woocommerce-orders-table th, .customer-section-body table.shop_table th {
    background: #f9fafb; padding: 11px 16px;
    font-size: 0.71rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--pm-text-light); border-bottom: 1px solid var(--pm-border);
    font-family: var(--pm-font) !important;
}
table.woocommerce-orders-table td, .customer-section-body table.shop_table td {
    padding: 12px 16px; border-bottom: 1px solid var(--pm-border);
    color: var(--pm-text-mid); vertical-align: middle;
}
table.woocommerce-orders-table tr:last-child td,
.customer-section-body table.shop_table tr:last-child td { border-bottom: none; }
table.woocommerce-orders-table tr:hover td,
.customer-section-body table.shop_table tr:hover td { background: #fafafa; }
.order-number a { font-weight: 700; color: var(--pm-primary); text-decoration: none; }

/* Status badges */
.woocommerce-order-status, mark.order-status {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 99px;
    font-size: 0.72rem; font-weight: 700;
    text-transform: capitalize; white-space: nowrap;
    font-family: var(--pm-font) !important;
}
.woocommerce-order-status.status-completed,  mark.order-status.status-completed  { background: #dcfce7; color: var(--pm-success); }
.woocommerce-order-status.status-processing, mark.order-status.status-processing { background: #eef2ff; color: var(--pm-primary); }
.woocommerce-order-status.status-on-hold,    mark.order-status.status-on-hold    { background: #fef9c3; color: var(--pm-warning); }
.woocommerce-order-status.status-pending,    mark.order-status.status-pending    { background: #f3f4f6; color: var(--pm-text-mid); }
.woocommerce-order-status.status-cancelled,  mark.order-status.status-cancelled  { background: #fee2e2; color: var(--pm-danger); }
.woocommerce-order-status.status-refunded,   mark.order-status.status-refunded   { background: #f5f3ff; color: var(--pm-accent); }
.woocommerce-order-status.status-failed,     mark.order-status.status-failed     { background: #fee2e2; color: var(--pm-danger); }

/* ── Avatar Modal ── */
.avatar-modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); z-index: 99999;
    align-items: center; justify-content: center;
}
.avatar-modal-overlay.open { display: flex; }
.avatar-modal {
    background: var(--pm-bg-card); border-radius: var(--pm-radius-md);
    padding: 30px; max-width: 420px; width: 92%;
    text-align: center; box-shadow: var(--pm-shadow-lg);
    animation: modalIn 0.22s ease;
}
@keyframes modalIn {
    from { opacity:0; transform:scale(0.95) translateY(16px); }
    to   { opacity:1; transform:scale(1)    translateY(0);    }
}
.avatar-modal h3 { font-size: 1.05rem; font-weight: 700; color: var(--pm-text-dark); margin: 0 0 5px; font-family: var(--pm-font-display) !important; }
.avatar-modal > p { font-size: 0.82rem; color: var(--pm-text-light); margin: 0 0 16px; }
.avatar-drop-zone {
    border: 2px dashed var(--pm-border); border-radius: var(--pm-radius-md);
    padding: 32px 18px; cursor: pointer; transition: all 0.2s; margin-bottom: 12px;
}
.avatar-drop-zone:hover, .avatar-drop-zone.dragover { border-color: var(--pm-primary); background: var(--pm-primary-light); }
.avatar-drop-zone svg { width: 38px; height: 38px; color: var(--pm-text-light); }
.avatar-drop-zone p { font-size: 0.82rem; color: var(--pm-text-light); margin: 8px 0 0; }
.avatar-drop-zone span { color: var(--pm-primary); font-weight: 700; }
.avatar-preview-wrap { display: none; margin: 12px 0; }
.avatar-preview-wrap img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid var(--pm-primary); margin: 0 auto; display: block; }
.avatar-modal-btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.btn-cancel-modal {
    background: none; border: 1.5px solid var(--pm-border); border-radius: var(--pm-radius-sm);
    padding: 9px 20px; color: var(--pm-text-mid); font-size: 0.87rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s; font-family: var(--pm-font) !important;
}
.btn-cancel-modal:hover { border-color: var(--pm-text-mid); background: var(--pm-bg); }
.btn-save-avatar {
    background: var(--pm-primary); color: #fff; border: none;
    border-radius: var(--pm-radius-sm); padding: 9px 22px;
    font-size: 0.87rem; font-weight: 700; cursor: pointer;
    transition: background 0.2s; font-family: var(--pm-font) !important;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-save-avatar:hover { background: var(--pm-primary-dark); }

/* ── Dark Mode Toggle ── */
#darkModeToggle {
    position: fixed; bottom: 26px; right: 26px; z-index: 9990;
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--pm-primary); color: #fff; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--pm-shadow-lg); font-size: 18px;
    transition: all var(--pm-transition);
}
#darkModeToggle:hover { background: var(--pm-primary-dark); transform: scale(1.1); }

/* ── Dark mode vars ── */
[data-theme="dark"] {
    --pm-text-dark:  #f1f5f9;
    --pm-text-mid:   #94a3b8;
    --pm-text-light: #64748b;
    --pm-border:     #1e293b;
    --pm-bg:         #0f172a;
    --pm-bg-card:    #1e293b;
    --pm-primary-light: #1e1b4b;
}
[data-theme="dark"] body { background: #0f172a !important; }

/* ── Order Progress ── */
.order-progress-track { display: flex; align-items: flex-start; padding: 22px 14px; }
.order-progress-step  { flex: 1; text-align: center; position: relative; z-index: 1; }
.step-circle {
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.87rem;
    border: 3px solid var(--pm-border); background: var(--pm-bg-card); color: var(--pm-text-light);
    transition: all 0.3s; position: relative; z-index: 2;
}
.order-progress-step.done   .step-circle { background: var(--pm-success); border-color: var(--pm-success); color: #fff; }
.order-progress-step.active .step-circle { background: var(--pm-primary); border-color: var(--pm-primary); color: #fff; box-shadow: 0 0 0 5px rgba(79,70,229,0.15); }
.step-label { font-size: 0.72rem; margin: 7px 0 0; color: var(--pm-text-light); font-weight: 500; }
.order-progress-step.done   .step-label { color: var(--pm-success); font-weight: 600; }
.order-progress-step.active .step-label { color: var(--pm-primary); font-weight: 700; }
.progress-connector { flex: 1; height: 3px; background: var(--pm-border); margin-top: 19px; border-radius: 2px; }
.progress-connector.done { background: var(--pm-success); }

/* ── Empty State ── */
.envo-empty-state { padding: 46px 26px; text-align: center; }
.envo-empty-state .empty-icon { font-size: 2.8rem; margin-bottom: 12px; line-height: 1; }
.envo-empty-state p { font-size: 0.9rem; color: var(--pm-text-light); margin-bottom: 16px; }

/* ── Account forms ── */
.woocommerce-account .woocommerce-EditAccountForm,
.woocommerce-account .woocommerce-address-fields,
.woocommerce-account form.woocommerce-form {
    background: var(--pm-bg-card); border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md); padding: 26px; box-shadow: var(--pm-shadow-sm);
}

/* Addresses grid */
.woocommerce-account .woocommerce-Addresses { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .woocommerce-account .woocommerce-Addresses { grid-template-columns: 1fr; } }
.woocommerce-account .woocommerce-Address {
    background: var(--pm-bg-card); border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md); padding: 20px; box-shadow: var(--pm-shadow-sm);
}
.woocommerce-account .woocommerce-Address .title h3 { font-size: 0.9rem; font-weight: 700; color: var(--pm-text-dark); margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--pm-border); font-family: var(--pm-font) !important; }
.woocommerce-account address { font-style: normal; color: var(--pm-text-mid); font-size: 0.88rem; line-height: 1.8; }

/* ── Responsive ── */
@media (max-width: 960px) {
    .woocommerce-account .woocommerce { flex-direction: column !important; padding: 0 16px !important; margin: 20px auto !important; gap: 14px !important; }
    .woocommerce-account .woocommerce-MyAccount-navigation { width: 100% !important; min-width: 0 !important; max-width: 100% !important; position: static !important; }
    .account-mobile-nav-toggle { display: flex; }
    .woocommerce-MyAccount-navigation { display: none !important; }
    .woocommerce-MyAccount-navigation.nav-open { display: block !important; }
    .customer-welcome-banner { padding: 20px 18px; }
    .banner-emoji { display: none; }
}
