/* ═══════════════════════════════════════════════════════════
   Store Account Dashboard  —  store-account.css
   ═══════════════════════════════════════════════════════════ */

:root {
    --sa-primary: #2563eb;
    --sa-primary-light: #eff6ff;
    --sa-sidebar-w: 260px;
    --sa-header-h: 64px;
    --sa-radius: 14px;
    --sa-font: 'Cairo', 'Inter', system-ui, sans-serif;
}

/* ── Wrapper ── */
.sa-wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: var(--sa-font);
    background: #f4f6fb;
}

/* ── Header ── */
.sa-header {
    height: var(--sa-header-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.sa-header__brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: inherit;
    font-weight: 700;
    font-size: .95rem;
    flex-shrink: 0;
}
.sa-header__brand img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
}
.sa-header__brand-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1e293b;
}

.sa-header__spacer { flex: 1; }

.sa-header__user {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: #64748b;
}
.sa-header__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--sa-primary-light);
    color: var(--sa-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sa-header__user-name {
    font-weight: 600;
    color: #334155;
}

.sa-header__btn {
    background: none;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: all .2s;
    font-size: .9rem;
}
.sa-header__btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* Hamburger - mobile only */
.sa-header__hamburger { display: none; }

/* ── Body (sidebar + content) ── */
.sa-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ── Sidebar ── */
.sa-sidebar {
    width: var(--sa-sidebar-w);
    background: #fff;
    border-inline-end: 1px solid #e5e7eb;
    padding: 1.25rem 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: var(--sa-header-h);
    height: calc(100vh - var(--sa-header-h));
    overflow-y: auto;
}

.sa-sidebar__label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
    padding: 0 1.25rem;
    margin-bottom: .5rem;
    margin-top: .75rem;
}
.sa-sidebar__label:first-child { margin-top: 0; }

.sa-sidebar__link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    font-size: .88rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: all .15s;
    border-inline-start: 3px solid transparent;
}
.sa-sidebar__link:hover {
    background: #f8fafc;
    color: #1e293b;
}
.sa-sidebar__link.active {
    background: var(--sa-primary-light);
    color: var(--sa-primary);
    font-weight: 600;
    border-inline-start-color: var(--sa-primary);
}
.sa-sidebar__link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sa-sidebar__divider {
    height: 1px;
    background: #e5e7eb;
    margin: .75rem 1.25rem;
}

.sa-sidebar__spacer { flex: 1; }

/* ── Content ── */
.sa-content {
    flex: 1;
    padding: 1.5rem;
    min-width: 0;
    overflow-y: auto;
}

/* ── Page header ── */
.sa-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
}
.sa-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* ── Stats Cards ── */
.sa-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sa-stat-card {
    background: #fff;
    border-radius: var(--sa-radius);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid #f1f5f9;
}
.sa-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.sa-stat-icon--orders   { background: #eff6ff; color: #2563eb; }
.sa-stat-icon--pending  { background: #fffbeb; color: #d97706; }
.sa-stat-icon--spent    { background: #f0fdf4; color: #16a34a; }

.sa-stat-info { min-width: 0; }
.sa-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}
.sa-stat-label {
    font-size: .78rem;
    color: #94a3b8;
    font-weight: 500;
}

/* ── Card ── */
.sa-card {
    background: #fff;
    border-radius: var(--sa-radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid #f1f5f9;
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.sa-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 1rem;
}
.sa-card__title {
    font-size: .95rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.sa-card__body {
    padding: 1.25rem;
}

/* ── Table ── */
.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.sa-table th {
    text-align: start;
    padding: .75rem 1rem;
    font-weight: 600;
    color: #64748b;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}
.sa-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}
.sa-table tbody tr {
    transition: background .15s;
}
.sa-table tbody tr:hover {
    background: #f8fafc;
}
.sa-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Status badges ── */
.sa-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .7rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
.sa-badge--pending    { background: #fef3c7; color: #92400e; }
.sa-badge--processing { background: #dbeafe; color: #1e40af; }
.sa-badge--shipped    { background: #e0e7ff; color: #3730a3; }
.sa-badge--delivered  { background: #dcfce7; color: #166534; }
.sa-badge--cancelled  { background: #fee2e2; color: #991b1b; }
.sa-badge--returned   { background: #f1f5f9; color: #475569; }

/* ── Order Timeline ── */
.sa-timeline {
    position: relative;
    padding-inline-start: 1.75rem;
}
.sa-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-start: 8px;
    width: 2px;
    background: #e5e7eb;
}
.sa-timeline__item {
    position: relative;
    padding-bottom: 1.25rem;
}
.sa-timeline__item:last-child { padding-bottom: 0; }
.sa-timeline__dot {
    position: absolute;
    inset-inline-start: -1.75rem;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e5e7eb;
    border: 3px solid #fff;
    z-index: 1;
}
.sa-timeline__item:first-child .sa-timeline__dot {
    background: var(--sa-primary);
}
.sa-timeline__status {
    font-weight: 600;
    font-size: .85rem;
    color: #1e293b;
}
.sa-timeline__date {
    font-size: .75rem;
    color: #94a3b8;
    margin-top: 2px;
}
.sa-timeline__note {
    font-size: .8rem;
    color: #64748b;
    margin-top: 2px;
}

/* ── Forms ── */
.sa-form-group {
    margin-bottom: 1rem;
}
.sa-form-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: .35rem;
}
.sa-form-input {
    width: 100%;
    padding: .65rem .85rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .88rem;
    font-family: var(--sa-font);
    color: #1e293b;
    transition: border-color .2s, box-shadow .2s;
    background: #fff;
}
.sa-form-input:focus {
    outline: none;
    border-color: var(--sa-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.sa-form-input::placeholder {
    color: #94a3b8;
}

/* ── Buttons ── */
.sa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1.25rem;
    border-radius: 10px;
    font-size: .85rem;
    font-weight: 600;
    font-family: var(--sa-font);
    cursor: pointer;
    transition: all .2s;
    border: none;
    text-decoration: none;
}
.sa-btn--primary {
    background: var(--sa-primary);
    color: #fff;
}
.sa-btn--primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.25);
}
.sa-btn--outline {
    background: #fff;
    color: #475569;
    border: 1.5px solid #e2e8f0;
}
.sa-btn--outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.sa-btn--danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
}
.sa-btn--danger:hover {
    background: #fee2e2;
}
.sa-btn--sm {
    padding: .4rem .85rem;
    font-size: .78rem;
}
.sa-btn--block {
    width: 100%;
}

/* ── Address card ── */
.sa-addr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.sa-addr-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: var(--sa-radius);
    padding: 1rem 1.15rem;
    position: relative;
    transition: border-color .2s;
}
.sa-addr-card:hover {
    border-color: #cbd5e1;
}
.sa-addr-card--default {
    border-color: var(--sa-primary);
    background: var(--sa-primary-light);
}
.sa-addr-label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    font-weight: 700;
    color: var(--sa-primary);
    margin-bottom: .5rem;
}
.sa-addr-name {
    font-weight: 600;
    font-size: .88rem;
    color: #1e293b;
}
.sa-addr-detail {
    font-size: .82rem;
    color: #64748b;
    margin-top: .2rem;
    line-height: 1.5;
}
.sa-addr-actions {
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
}
.sa-addr-default-badge {
    position: absolute;
    top: .75rem;
    inset-inline-end: .75rem;
    font-size: .68rem;
    font-weight: 700;
    background: var(--sa-primary);
    color: #fff;
    padding: .15rem .55rem;
    border-radius: 6px;
}

/* ── Empty state ── */
.sa-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}
.sa-empty i {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    display: block;
    opacity: .5;
}
.sa-empty p {
    font-size: .9rem;
    margin-bottom: 1rem;
}

/* ── Loading ── */
.sa-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #94a3b8;
    gap: .5rem;
    font-size: .88rem;
}

/* ── Pagination ── */
.sa-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: 1rem;
}
.sa-pagination__btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all .15s;
    font-family: var(--sa-font);
}
.sa-pagination__btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.sa-pagination__btn.active {
    background: var(--sa-primary);
    color: #fff;
    border-color: var(--sa-primary);
}
.sa-pagination__btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* ── Mobile Bottom Nav ── */
.sa-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    z-index: 100;
    box-shadow: 0 -1px 4px rgba(0,0,0,.05);
}
.sa-bottom-nav__items {
    display: flex;
    height: 100%;
}
.sa-bottom-nav__link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: #94a3b8;
    font-size: .65rem;
    font-weight: 600;
    transition: color .15s;
}
.sa-bottom-nav__link.active {
    color: var(--sa-primary);
}
.sa-bottom-nav__link i {
    font-size: 1.2rem;
}

/* ── Overlay for mobile sidebar ── */
.sa-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(4px);
    z-index: 199;
}

/* ═══════════════════════════════
   Responsive
   ═══════════════════════════════ */

@media (max-width: 1024px) {
    .sa-sidebar {
        width: 220px;
    }
    :root { --sa-sidebar-w: 220px; }
}

@media (max-width: 768px) {
    .sa-header__hamburger { display: flex; }
    .sa-header__user-name { display: none; }

    .sa-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        inset-inline-start: 0;
        width: 280px;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        padding-top: calc(var(--sa-header-h) + .5rem);
    }
    html[dir="rtl"] .sa-sidebar {
        transform: translateX(100%);
    }
    .sa-sidebar.open {
        transform: translateX(0);
    }
    html[dir="rtl"] .sa-sidebar.open {
        transform: translateX(0);
    }
    .sa-overlay.open { display: block; }

    .sa-content {
        padding: 1rem;
        padding-bottom: 80px;
    }

    .sa-bottom-nav { display: block; }

    .sa-stats {
        grid-template-columns: 1fr 1fr;
    }

    .sa-table-wrap { overflow-x: auto; }

    .sa-addr-grid {
        grid-template-columns: 1fr;
    }

    .sa-page-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .sa-stats {
        grid-template-columns: 1fr;
    }
    .sa-header__brand-name { display: none; }
}

/* ── Auth pages (login/register) ── */
.sa-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1rem;
    font-family: var(--sa-font);
}
.sa-auth-card {
    background: #fff;
    border-radius: 18px;
    box-shadow:
        0 1px 3px rgba(0,0,0,.04),
        0 8px 32px rgba(0,0,0,.08);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem 2rem;
}
.sa-auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}
.sa-auth-logo img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
}
.sa-auth-logo h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin: .5rem 0 .15rem;
}
.sa-auth-logo p {
    font-size: .82rem;
    color: #94a3b8;
    margin: 0;
}
.sa-auth-divider {
    text-align: center;
    font-size: .8rem;
    color: #94a3b8;
    margin: 1.25rem 0;
}
.sa-auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: .85rem;
    color: #64748b;
}
.sa-auth-footer a {
    color: var(--sa-primary);
    font-weight: 600;
    text-decoration: none;
}
.sa-auth-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .sa-auth-card {
        padding: 1.75rem 1.25rem;
    }
}
