/* ===== Custom My Account — myaccount.css v1.0 ===== */

/* ── Fonts ── */
.cma-wrap h1, .cma-wrap h2, .cma-wrap h3,
.cma-orders-title,
.cma-hello-name,
.cma-info-title,
.cma-add-again-btn,
.cma-save-btn,
.cma-view-more-btn {
    font-family: 'Brice', 'Georgia', serif !important;
}

.cma-wrap,
.cma-wrap p, .cma-wrap span, .cma-wrap a,
.cma-wrap input, .cma-wrap button, .cma-wrap label {
    font-family: 'Galano Grotesque', 'Galano', 'Nunito Sans', sans-serif !important;
}

/* ── Reset ── */
.cma-wrap *, .cma-wrap *::before, .cma-wrap *::after { box-sizing: border-box; }

/* ══════════════════════════
   LAYOUT
══════════════════════════ */
.cma-wrap {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-areas: "left right";
    gap: 24px;
    align-items: start;
    padding: 20px 0;
    width: 100%;
}

@media (max-width: 900px) {
    .cma-wrap {
        grid-template-columns: 1fr;
        grid-template-areas: "left" "right";
        gap: 16px;
    }
}

/* ══════════════════════════
   LEFT
══════════════════════════ */
.cma-left {
    grid-area: left;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Hello card */
.cma-hello-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    gap: 14px;
}

.cma-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e8edf5;
    flex-shrink: 0;
}

.cma-hello-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cma-hello-label {
    font-size: 13px !important;
    color: #888 !important;
}

.cma-hello-name {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #1a1a2e !important;
    line-height: 1.2;
}

.cma-hello-name span,
.cma-hello-name {
    /* name part in blue */
}

/* Edit link */
.cma-edit-link {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #888 !important;
    text-decoration: none !important;
    flex-shrink: 0;
    align-self: flex-start;
    transition: color 0.15s;
}
.cma-edit-link:hover { color: #1a3a8f !important; }

/* Personal info card */
.cma-info-card {
    background: #fff;
    border-radius: 16px;
    padding: 22px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.cma-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cma-info-title {
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #1a3a8f !important;
    margin: 0 !important;
}

/* Info grid */
.cma-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 16px;
}

.cma-info-group-full {
    grid-column: 1 / -1;
}

.cma-info-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cma-info-label {
    font-size: 13px !important;
    color: #aaa !important;
    font-weight: 400 !important;
}

.cma-info-value {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    line-height: 1.5;
}

/* Edit form */
.cma-info-edit-form { margin-top: 4px; }

.cma-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.cma-edit-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cma-edit-field-full {
    grid-column: 1 / -1;
}

.cma-edit-field label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #555 !important;
}

.cma-edit-field input {
    border: 1.5px solid #e0e0e8 !important;
    border-radius: 8px !important;
    padding: 9px 12px !important;
    font-size: 14px !important;
    color: #333 !important;
    background: #fff !important;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color 0.15s;
}

.cma-edit-field input:focus {
    border-color: #1a3a8f !important;
}

.cma-edit-actions {
    display: flex;
    gap: 10px;
}

.cma-save-btn {
    background: #1a3a8f !important;
    border: none !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    padding: 10px 22px !important;
    cursor: pointer;
    transition: background 0.15s;
}
.cma-save-btn:hover { background: #142d6e !important; }

.cma-cancel-btn {
    background: #f0f0f5 !important;
    border: none !important;
    color: #555 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    padding: 10px 18px !important;
    cursor: pointer;
    transition: background 0.15s;
}
.cma-cancel-btn:hover { background: #e0e0ea !important; }

.cma-save-msg {
    font-size: 13px;
    margin-top: 8px !important;
    min-height: 16px;
}
.cma-save-msg.ok  { color: #1a9e5a; font-weight: 600; }
.cma-save-msg.err { color: #e24b4a; }

/* Login notice */
.cma-login-notice {
    font-size: 15px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.cma-login-notice a { color: #1a3a8f; font-weight: 600; }

/* ══════════════════════════
   RIGHT — Orders
══════════════════════════ */
.cma-right {
    grid-area: right;
    min-width: 0;
}

.cma-orders-card {
    background: #1a3a8f;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(26,58,143,.25);
}

.cma-orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cma-orders-title {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #fff !important;
    margin: 0 !important;
}

.cma-view-more-btn {
    background: transparent !important;
    border: 2px solid #fff !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    padding: 8px 18px !important;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.15s, color 0.15s;
    display: inline-block;
}
.cma-view-more-btn:hover {
    background: #fff !important;
    color: #1a3a8f !important;
}

.cma-no-orders {
    color: rgba(255,255,255,.7) !important;
    font-size: 15px;
    padding: 20px 0;
}
.cma-no-orders a {
    color: #fff !important;
    font-weight: 600 !important;
    text-decoration: underline !important;
}

/* Order item card */
.cma-order-item {
    display: flex;
    align-items: stretch;
    gap: 16px;
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.cma-order-item:last-child { margin-bottom: 0; }
.cma-order-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

/* Product image */
.cma-order-img-wrap {
    width: 110px;
    height: 110px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5e8d0;
}
.cma-order-img-wrap img.cma-order-thumb,
.cma-order-img-wrap img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    display: block;
}

@media (max-width: 500px) {
    .cma-order-img-wrap {
        width: 80px; height: 80px;
    }
    .cma-order-img-wrap img { width: 80px; height: 80px; }
}

/* Order body */
.cma-order-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cma-order-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.cma-order-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cma-order-id {
    font-size: 12px !important;
    color: #888 !important;
}

.cma-order-more-items {
    font-size: 11px !important;
    color: #aaa !important;
}

/* Status badges */
.cma-status-badge {
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.cma-status-completed,
.cma-status-delivered {
    background: #1abf6f !important;
    color: #fff !important;
}

.cma-status-processing {
    background: #f59e0b !important;
    color: #fff !important;
}

.cma-status-pending {
    background: #6b7280 !important;
    color: #fff !important;
}

.cma-status-on-hold {
    background: #3b82f6 !important;
    color: #fff !important;
}

.cma-status-cancelled,
.cma-status-failed {
    background: #e24b4a !important;
    color: #fff !important;
}

/* Order product details */
.cma-order-brand {
    font-size: 12px !important;
    color: #888 !important;
    margin-top: 2px;
}

.cma-order-name {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    line-height: 1.3;
}

/* Qty badge */
.cma-order-qty-badge {
    display: inline-block;
    background: #f0f4ff;
    color: #1a3a8f;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 4px 14px !important;
    border-radius: 20px !important;
    width: fit-content;
    margin-top: 2px;
}

/* Price row */
.cma-order-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 6px;
    flex-wrap: wrap;
    gap: 8px;
}

.cma-order-prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.cma-price-old {
    font-size: 13px !important;
    color: #aaa !important;
    text-decoration: line-through !important;
}

.cma-price-cur {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #1a3a8f !important;
}

/* Add Again button */
.cma-add-again-btn {
    display: flex !important;
    align-items: center !important;
    gap: 7px;
    background: #e85d1a !important;
    border: none !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    padding: 9px 16px !important;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.15s;
    text-decoration: none !important;
}
.cma-add-again-btn:hover {
    background: #c94b10 !important;
    transform: translateY(-1px);
}
.cma-add-again-btn:disabled {
    background: #f0a070 !important;
    cursor: not-allowed;
    transform: none;
}
.cma-add-again-btn.added {
    background: #1abf6f !important;
}
.cma-add-again-btn svg { flex-shrink: 0; }

/* ══════════════════════════
   MORE ITEMS BUTTON
══════════════════════════ */
.cma-more-items-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    font-size: 12px !important;
    color: #1a3a8f !important;
    font-weight: 700 !important;
    cursor: pointer;
    text-decoration: underline !important;
    text-decoration-style: dotted !important;
    transition: color 0.15s;
    text-align: left;
}
.cma-more-items-btn:hover { color: #e85d1a !important; }

/* ══════════════════════════
   POPUP OVERLAY
══════════════════════════ */
.cma-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 50, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    /* display is controlled by JS — do NOT set display:flex here or it overrides style="display:none" */
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: cma-fade-in 0.2s ease;
}

/* When the overlay is visible (JS sets display:block via fadeIn — we switch it to flex) */
.cma-popup-overlay[style*="display: block"],
.cma-popup-overlay[style*="display:block"] {
    display: flex !important;
}

@keyframes cma-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cma-popup {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: cma-slide-up 0.25s ease;
    overflow: hidden;
}

@keyframes cma-slide-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cma-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 2px solid #f0f0f5;
    flex-shrink: 0;
}

.cma-popup-title {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #1a1a2e !important;
    margin: 0 !important;
    font-family: 'Brice', 'Georgia', serif !important;
}

.cma-popup-title span {
    color: #1a3a8f;
}

.cma-popup-close {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1.5px solid #e0e0e8 !important;
    background: #fff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    padding: 0 !important;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.cma-popup-close:hover {
    border-color: #e24b4a !important;
    color: #e24b4a !important;
    background: #fff5f5 !important;
}

/* Popup body — scrollable */
.cma-popup-body {
    overflow-y: auto;
    padding: 16px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar styling */
.cma-popup-body::-webkit-scrollbar { width: 6px; }
.cma-popup-body::-webkit-scrollbar-track { background: #f5f5f5; border-radius: 4px; }
.cma-popup-body::-webkit-scrollbar-thumb { background: #d0d5e8; border-radius: 4px; }
.cma-popup-body::-webkit-scrollbar-thumb:hover { background: #1a3a8f; }

/* Popup item row */
.cma-popup-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8f9fc;
    border-radius: 14px;
    padding: 14px;
    transition: background 0.15s;
}
.cma-popup-item:hover { background: #f0f4ff; }

.cma-popup-img {
    width: 70px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f0ece4;
}
.cma-popup-img img.cma-popup-thumb,
.cma-popup-img img {
    width: 70px;
    height: 60px;
    object-fit: cover;
    display: block;
}
.cma-popup-img-placeholder {
    width: 70px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    color: #ccc; font-size: 24px;
}

.cma-popup-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cma-popup-brand {
    font-size: 11px !important;
    color: #aaa !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cma-popup-name {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    line-height: 1.3;
    word-break: break-word;
}

.cma-popup-qty {
    display: inline-block;
    background: #e8edf8;
    color: #1a3a8f;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 3px 10px !important;
    border-radius: 20px !important;
    width: fit-content;
}

.cma-popup-price-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.cma-popup-price-old {
    font-size: 12px !important;
    color: #bbb !important;
    text-decoration: line-through !important;
}

.cma-popup-price-cur {
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #1a3a8f !important;
}

.cma-popup-add-btn {
    display: flex !important;
    align-items: center !important;
    gap: 5px;
    background: #e85d1a !important;
    border: none !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
    font-family: 'Galano Grotesque', 'Galano', 'Nunito Sans', sans-serif !important;
}
.cma-popup-add-btn:hover { background: #c94b10 !important; }
.cma-popup-add-btn:disabled { background: #f0a070 !important; cursor: not-allowed; }
.cma-popup-add-btn.added   { background: #1abf6f !important; }

/* ══════════════════════════
   INLINE PRODUCT ROWS (replaces old flex layout)
══════════════════════════ */

/* Re-style order-item as a vertical card */
.cma-order-item {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    background: #fff;
    border-radius: 14px;
    padding: 0;
    margin-bottom: 12px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}
.cma-order-item:last-child { margin-bottom: 0; }
.cma-order-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

/* Order top bar */
.cma-order-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f8;
    flex-wrap: wrap;
    gap: 8px;
}

.cma-order-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cma-order-id {
    font-size: 12px !important;
    color: #888 !important;
    font-weight: 600 !important;
}

.cma-order-count {
    font-size: 11px !important;
    background: #e8edf8;
    color: #1a3a8f;
    font-weight: 700 !important;
    padding: 2px 8px;
    border-radius: 20px;
}

/* Products list container */
.cma-order-products {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Single product row inside an order */
.cma-product-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5fa;
    transition: background 0.12s;
}
.cma-product-row:last-child { border-bottom: none; }
.cma-product-row:hover { background: #fafbff; }

/* Product thumbnail */
.cma-product-img-wrap {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5e8d0;
}
.cma-product-img-wrap img.cma-order-thumb,
.cma-product-img-wrap img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    display: block;
}
.cma-product-img-placeholder {
    width: 72px; height: 72px;
    display: flex; align-items: center; justify-content: center;
    color: #ccc; font-size: 22px;
}

/* Product info (name, brand, qty) */
.cma-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cma-product-info .cma-order-brand {
    font-size: 11px !important;
    color: #aaa !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cma-product-info .cma-order-name {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}

.cma-product-info .cma-order-qty-badge {
    display: inline-block;
    background: #f0f4ff;
    color: #1a3a8f;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 2px 10px !important;
    border-radius: 20px !important;
    width: fit-content;
}

/* Right side: price + add button */
.cma-product-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.cma-product-actions .cma-order-prices {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.cma-product-actions .cma-price-old {
    font-size: 11px !important;
    color: #bbb !important;
    text-decoration: line-through !important;
}

.cma-product-actions .cma-price-cur {
    font-size: 14px !important;
    font-weight: 800 !important;
    color: #1a3a8f !important;
}

.cma-product-actions .cma-add-again-btn {
    font-size: 12px !important;
    padding: 7px 12px !important;
}

@media (max-width: 500px) {
    .cma-product-row { gap: 8px; padding: 10px 12px; }
    .cma-product-img-wrap { width: 56px; height: 56px; }
    .cma-product-img-wrap img { width: 56px; height: 56px; }
    .cma-product-img-placeholder { width: 56px; height: 56px; }
    .cma-product-actions .cma-add-again-btn { padding: 6px 10px !important; font-size: 11px !important; }
}
