@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

.skip-link {
    position: absolute;
    top: -100%;
    right: 0;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    font-size: 14px;
    text-decoration: none;
    border-radius: 0 0 0 8px;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 0;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:root {
    --primary: #6366F1;
    --primary-hover: #5558e6;
    --primary-light: #818cf8;
    --primary-bg: rgba(99, 102, 241, 0.1);
    --bg: #ffffff;
    --bg-card: #f8f9fa;
    --bg-sidebar: #f1f3f5;
    --bg-input: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #595d66;
    --text-muted: #717680;
    --border: #e5e7eb;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    --purple: #8b5cf6;
    --purple-bg: rgba(139, 92, 246, 0.1);
    --bg-secondary: #eef0f3;
    --text-primary: #1a1a2e;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) {
        --bg: #0f1117;
        --bg-card: #1a1b2e;
        --bg-sidebar: #151623;
        --bg-input: #1a1b2e;
        --bg-secondary: #232538;
        --text-primary: #e5e7eb;
        --text: #e5e7eb;
        --text-secondary: #b0b5bd;
        --text-muted: #8a8f99;
        --border: #2d2f3d;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
        --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    }
}

.dark {
    --bg: #0f1117;
    --bg-card: #1a1b2e;
    --bg-sidebar: #151623;
    --bg-input: #1a1b2e;
    --bg-secondary: #232538;
    --text-primary: #e5e7eb;
    --text: #e5e7eb;
    --text-secondary: #b0b5bd;
    --text-muted: #8a8f99;
    --border: #2d2f3d;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

.light {
    --bg: #ffffff;
    --bg-card: #f8f9fa;
    --bg-sidebar: #f1f3f5;
    --bg-input: #ffffff;
    --bg-secondary: #eef0f3;
    --text-primary: #1a1a2e;
    --text: #1a1a2e;
    --text-secondary: #595d66;
    --text-muted: #717680;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

img {
    max-width: 100%;
    height: auto;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }
.text-2xl { font-size: 32px; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.p-32 { padding: 32px; }
.hidden { display: none; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}

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

.card-sm {
    padding: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
}

.card-body {
    margin-top: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 5px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

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

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

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

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

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #059669;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-bg);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-block {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg-input);
    transition: var(--transition);
    direction: rtl;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 32px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-nav {
    padding: 12px;
    flex: 1;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    text-decoration: none;
}

.sidebar-item:hover {
    background: var(--bg-card);
    color: var(--text);
}

.sidebar-item.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 700;
}

.sidebar-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-group {
    margin-bottom: 4px;
}
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    border: none;
    background: none;
    text-align: right;
}
.sidebar-group-toggle:hover {
    background: var(--bg-card);
    color: var(--text);
}
.sidebar-group-toggle svg.group-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.sidebar-group-toggle .group-arrow {
    width: 14px;
    height: 14px;
    margin-right: auto;
    margin-left: 0;
    transition: transform 0.2s ease;
    opacity: 0.5;
}
.sidebar-group.open > .sidebar-group-toggle .group-arrow {
    transform: rotate(90deg);
}
.sidebar-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.sidebar-group.open > .sidebar-group-items {
    max-height: 500px;
}
.sidebar-group-items .sidebar-item {
    padding-right: 46px;
    font-size: 13px;
}
.sidebar-group.has-active > .sidebar-group-toggle {
    color: var(--primary);
}
.admin-sidebar .sidebar-group-toggle {
    color: rgba(255,255,255,0.7);
}
.admin-sidebar .sidebar-group-toggle:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.admin-sidebar .sidebar-group.has-active > .sidebar-group-toggle {
    color: #fff;
}
.admin-sidebar .sidebar-group-items .sidebar-item {
    padding-right: 46px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-header-title {
    font-size: 18px;
    font-weight: 700;
}

.main-body {
    padding: 32px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
}

.mobile-toggle svg {
    width: 24px;
    height: 24px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-right: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .main-body {
        padding: 16px;
    }

    .main-header {
        padding: 12px 16px;
    }
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
    flex-wrap: nowrap;
    align-items: center;
    white-space: nowrap;
}

.tab {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    background: none;
    border-top: none;
    border-right: none;
    border-left: none;
    font-family: 'Tajawal', sans-serif;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 13px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 22px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--bg-card);
    color: var(--text);
}

.pagination .active {
    background: var(--primary);
    color: #ffffff;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

.search-box {
    position: relative;
    max-width: 320px;
}

.search-box input {
    padding-right: 40px;
}

.search-box svg {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-sidebar);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 12px;
    overflow: hidden;
}

.product-image svg {
    width: 40px;
    height: 40px;
    opacity: 0.4;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--danger); }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
}

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--text);
    background: var(--border);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.public-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

.public-header .container {
    padding-top: 0;
    padding-bottom: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
    flex-shrink: 0;
}

.header-menu-area {
    display: flex;
    align-items: center;
}

.header-menu-row {
    display: flex;
    justify-content: flex-start;
    padding: 6px 0 10px;
}

.header-menu-row .store-menu {
    flex-wrap: wrap;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto;
}

.header-center form {
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.public-logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    flex-shrink: 0;
    white-space: nowrap;
}

.store-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.store-menu-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
}

.store-menu-label {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.store-submenu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0;
    min-width: 180px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 120;
}

.store-submenu .store-menu-link {
    width: 100%;
    white-space: normal;
}

.store-menu-item.open > .store-submenu {
    display: flex;
}

.store-menu-link {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    text-decoration: none;
}

.store-menu-item.has-children > .store-menu-link::after,
.store-menu-item.has-children > .store-menu-label::after {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    margin-inline-start: 0;
    opacity: 0.7;
}

@media (hover: none) {
    .store-menu-label {
        width: 100%;
    }
}

@media (hover: hover) {
    .store-menu-item.has-children > .store-menu-link::after,
    .store-menu-item.has-children > .store-menu-label::after {
        margin-inline-start: 5px;
    }
}

.store-menu-link:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

@media (hover: hover) {
    .store-menu-item.has-children:hover > .store-submenu {
        display: flex;
    }
}

.announcement-bar--marquee {
    overflow: hidden;
}

.announcement-bar--marquee .announcement-bar__track {
    display: inline-flex;
    align-items: center;
    gap: 32px;
    white-space: nowrap;
    animation: announcement-marquee var(--announcement-speed, 30s) linear infinite;
    will-change: transform;
}

@keyframes announcement-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

@media (prefers-reduced-motion: reduce) {
    .announcement-bar--marquee .announcement-bar__track {
        animation: none;
    }
}

.sf-themed .public-header {
    background: var(--sf-header-bg);
    border-bottom-color: var(--sf-border);
}

.sf-themed .public-logo {
    color: var(--sf-header-text);
}

.sf-themed .store-menu-link {
    color: var(--sf-header-text);
}

.sf-themed .store-menu-link:hover {
    background: rgba(255,255,255,0.1);
    color: var(--sf-primary);
}

.sf-themed .store-submenu {
    background: var(--sf-header-bg);
    border-color: var(--sf-border);
}

.sf-themed .header-actions .btn-ghost {
    color: var(--sf-header-text);
}

.sf-themed .header-actions .theme-toggle {
    color: var(--sf-header-text);
}

.sf-themed .header-actions .mobile-menu-toggle {
    color: var(--sf-header-text);
}

.customer-dropdown-wrapper {
    position: relative;
}

.customer-dropdown-btn {
    cursor: pointer;
}

.customer-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 200;
    padding: 4px 0;
}

.customer-dropdown-wrapper.open .customer-dropdown {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item-danger {
    color: var(--danger, #dc2626);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text);
    border-radius: 6px;
    transition: background 0.2s;
}

.mobile-menu-toggle:hover {
    background: var(--bg-secondary);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--storefront-top-offset, 56px);
    right: 0;
    width: min(88vw, 320px);
    max-width: 100%;
    height: calc(100vh - var(--storefront-top-offset, 56px));
    background: var(--bg);
    border-left: 1px solid var(--border);
    z-index: 150;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.mobile-menu.open {
    transform: translateX(0);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: var(--storefront-top-offset, 56px);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 140;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu-overlay.open {
    opacity: 1;
}

.mobile-menu-inner {
    padding: 16px;
}

.mobile-menu-search {
    margin-bottom: 16px;
}

.mobile-menu-search form {
    width: 100%;
}

.mobile-menu-search .form-input {
    width: 100% !important;
    min-width: 100% !important;
}

.mobile-menu-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
    padding: 0 8px;
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
}

.mobile-menu .store-menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 0;
}

.mobile-menu .store-menu-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: normal;
    overflow-wrap: anywhere;
}

.mobile-menu .store-menu-item {
    width: 100%;
    display: block;
}

.mobile-menu .store-submenu {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
    margin-top: 4px;
    margin-inline-start: 12px;
    display: none;
}

.mobile-menu .store-menu-item.open > .store-submenu {
    display: flex;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s;
}

.mobile-menu-item:hover {
    background: var(--bg-secondary);
}

.mobile-menu .public-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.mobile-menu .public-nav .btn-ghost,
.mobile-menu .public-nav a,
.mobile-menu .public-nav button {
    width: 100%;
    justify-content: flex-start;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
}

.mobile-menu-item-danger {
    color: var(--danger, #dc2626);
}

.hide-mobile-text {
    display: inline;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 0;
    margin: 0;
    list-style: none;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '\203A';
    padding: 0 8px;
    color: var(--text-secondary);
    font-size: 16px;
}

.breadcrumb-item a {
    color: var(--text-secondary);
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--text);
    font-weight: 500;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    .hide-mobile-text {
        display: none;
    }
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
    }
    .mobile-menu {
        display: block;
    }
    .mobile-menu-overlay {
        display: block;
        pointer-events: none;
    }
    .mobile-menu-overlay.open {
        pointer-events: auto;
    }
    .customer-name-text {
        display: none;
    }
    .header-center {
        display: none;
    }
}

.hero {
    padding: 80px 0;
    background: linear-gradient(135deg, #6366F1 0%, #8b5cf6 50%, #a855f7 100%);
    color: #ffffff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.1) 0%, transparent 50%);
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 16px;
    position: relative;
}

.hero p {
    font-size: 20px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 32px;
    position: relative;
}

.hero .btn {
    position: relative;
}

.stats-section {
    padding: 48px 0;
    background: var(--bg-secondary);
}
.stat-card {
    text-align: center;
    padding: 24px;
}
.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
}
.stat-label {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}
.featured-stores-section {
    padding: 60px 0;
}
.featured-stores-section h2 {
    text-align: center;
    margin-bottom: 36px;
}
.featured-store-card {
    text-align: center;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.featured-store-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.featured-store-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto 12px;
}
.featured-store-card h3 {
    margin-bottom: 4px;
    font-size: 16px;
}

.features-section {
    padding: 80px 0;
}

.features-section h2 {
    text-align: center;
    margin-bottom: 48px;
}

.feature-card {
    text-align: center;
    padding: 32px 24px;
}

.feature-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.feature-icon svg {
    width: 28px;
    height: 28px;
}

.feature-card h3 {
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

.pricing-section {
    padding: 80px 0;
    background: var(--bg-card);
}

.pricing-section h2 {
    text-align: center;
    margin-bottom: 48px;
}

.pricing-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    transition: var(--transition);
}

.pricing-card.featured {
    border-color: var(--primary);
    position: relative;
}

.pricing-card.featured::before {
    content: 'الأكثر شيوعاً';
    position: absolute;
    top: -12px;
    right: 50%;
    transform: translateX(50%);
    background: var(--primary);
    color: #fff;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.pricing-card h3 {
    margin-bottom: 8px;
}

.pricing-price {
    font-size: 40px;
    font-weight: 800;
    color: var(--primary);
    margin: 16px 0;
}

.pricing-price span {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
}

.pricing-features {
    text-align: right;
    margin: 24px 0;
}

.pricing-features li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pricing-features li svg {
    width: 16px;
    height: 16px;
    color: var(--success);
    flex-shrink: 0;
}

.testimonials-section {
    padding: 80px 0;
}

.testimonials-section h2 {
    text-align: center;
    margin-bottom: 48px;
}

.testimonial-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.testimonial-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.testimonial-name {
    font-weight: 600;
    font-size: 14px;
}

.testimonial-role {
    font-size: 12px;
    color: var(--text-muted);
}

.cta-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #6366F1 0%, #8b5cf6 100%);
    color: #ffffff;
    text-align: center;
}

.cta-section h2 {
    color: #ffffff;
    margin-bottom: 16px;
}

.cta-section p {
    opacity: 0.9;
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.public-footer {
    padding: 48px 0 24px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.footer-section h4 {
    margin-bottom: 16px;
    font-size: 16px;
}

.footer-section a {
    display: block;
    color: var(--text-secondary);
    padding: 4px 0;
    font-size: 14px;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 32px;
    color: var(--primary);
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
}

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

.order-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}

.order-number {
    font-weight: 700;
    font-size: 15px;
}

.order-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.order-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.order-total {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.store-banner {
    background: linear-gradient(135deg, var(--sf-primary, var(--primary)) 0%, var(--sf-primary-light, var(--primary-light)) 100%);
    padding: 48px 0;
    color: var(--sf-on-primary, #ffffff);
    text-align: center;
}

.store-banner h1 {
    color: var(--sf-on-primary, #ffffff);
    font-size: 36px;
    margin-bottom: 8px;
}

.store-banner p {
    opacity: 0.9;
    font-size: 16px;
}

.gallery {
    position: sticky;
    top: 24px;
}

.gallery-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
    overflow: hidden;
    margin-bottom: 10px;
}

.gallery-slide {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.gallery-slide.active {
    display: flex;
}

.gallery-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 1px 6px rgba(0,0,0,0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #222;
    padding: 0;
    transition: box-shadow 0.2s;
}

.gallery-btn:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }

.gallery-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
    direction: ltr;
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.gallery-dot.active {
    background: var(--primary);
    transform: scale(1.25);
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: none;
}

.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumbs button {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: #fff;
    padding: 3px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s, border-color 0.2s;
}

.gallery-thumbs button:hover { opacity: 0.85; }

.gallery-thumbs button.active {
    border-color: var(--primary);
    opacity: 1;
}

.gallery-thumbs button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.gallery-empty {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
}

.gallery-empty svg {
    width: 72px;
    height: 72px;
    opacity: 0.25;
}

@media (max-width: 768px) {
    .gallery-thumbs button {
        width: 56px;
        height: 56px;
    }
    .gallery-btn {
        width: 34px;
        height: 34px;
    }
}

.product-detail-info {
    padding: 24px 0;
}

.product-detail-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    margin: 16px 0;
}

.product-detail-compare {
    font-size: 18px;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-right: 12px;
}

.product-detail-desc {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 24px;
}

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    flex: 1;
    min-width: 200px;
}

.quick-action:hover {
    box-shadow: var(--shadow-md);
    color: var(--primary);
}

.quick-action svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.storefront-product {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
}

.storefront-product:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--text);
}

.storefront-product .product-image {
    border-radius: 0;
    margin-bottom: 0;
}

.storefront-product-info {
    padding: 16px;
    flex: 1 1 auto;
}

.storefront-product > a {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.storefront-product form {
    margin-top: auto;
}

.storefront-product-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.storefront-product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 768px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero p {
        font-size: 16px;
    }
}

.type-fields {
    display: none;
}

.type-fields.active {
    display: block;
}

.actions-cell {
    display: flex;
    gap: 4px;
    align-items: center;
}

.admin-sidebar {
    background: var(--admin-sidebar-bg, #1a1a2e);
}
.admin-sidebar .sidebar-header {
    border-bottom-color: rgba(255,255,255,0.1);
}
.admin-sidebar .sidebar-logo {
    color: #e0e0ff;
}
.admin-sidebar .sidebar-item {
    color: rgba(255,255,255,0.7);
}
.admin-sidebar .sidebar-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.admin-sidebar .sidebar-item.active {
    color: #fff;
    background: rgba(99,102,241,0.3);
    border-right-color: #6366F1;
}
.sidebar-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.4);
    padding: 8px 20px 4px;
    font-weight: 600;
}
.admin-sidebar .sidebar-footer {
    border-top-color: rgba(255,255,255,0.1);
}
.admin-sidebar .sidebar-user-name {
    color: #fff;
}
.admin-sidebar .sidebar-user-email {
    color: rgba(255,255,255,0.5);
}
.admin-avatar {
    background: rgba(99,102,241,0.3);
    color: #a5b4fc;
}
.admin-sidebar .btn-ghost {
    color: rgba(255,255,255,0.7);
}
.admin-sidebar .btn-ghost:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.dark .admin-sidebar {
    background: #0f0f1a;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-bar .search-box {
    flex: 1;
    min-width: 200px;
}

.filter-bar .form-select {
    width: auto;
    min-width: 150px;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.order-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-form {
    max-width: 600px;
}

.settings-form .form-group {
    margin-bottom: 24px;
}

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-method-option {
    display: block;
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: border-color 0.2s, background 0.2s;
}

.payment-method-option:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.payment-method-option input[type="radio"] {
    display: none;
}

.payment-method-option input[type="radio"]:checked + .payment-method-content {
    color: var(--primary);
}

.payment-method-option:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.payment-method-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.payment-method-content svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.payment-method-option:has(input[type="radio"]:checked) .payment-method-content svg {
    color: var(--primary);
}

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

.data-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    background: var(--bg-card);
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.data-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

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

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}
.toast {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    animation: toastIn 0.3s ease forwards;
    max-width: 90vw;
    word-break: break-word;
}
.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}
.toast-success {
    background: var(--success);
    color: #fff;
}
.toast-error {
    background: var(--danger);
    color: #fff;
}
.toast-warning {
    background: var(--warning);
    color: #fff;
}
.toast-info {
    background: var(--info, #3b82f6);
    color: #fff;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-12px); }
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}
.confirm-dialog {
    background: var(--bg);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
}
.confirm-dialog h3 {
    margin-bottom: 8px;
    font-size: 18px;
    color: var(--text);
}
.confirm-dialog p {
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}
.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}
.btn-loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    inset-inline-start: calc(50% - 7px);
    top: calc(50% - 7px);
}
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}
.toggle-switch input[type="checkbox"] {
    display: none;
}
.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    inset-inline-start: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(-20px);
}
[dir="ltr"] .toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
}
.toggle-label {
    font-size: 14px;
    font-weight: 500;
}
.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.radio-option:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}
.radio-option input[type="radio"] {
    margin-top: 4px;
    accent-color: var(--primary);
    flex-shrink: 0;
}
.radio-option input[type="radio"]:checked ~ span strong {
    color: var(--primary);
}
.notif-bell-wrapper {
    position: relative;
}
.notif-bell-btn {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-primary);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notif-bell-btn:hover {
    background: var(--bg-secondary);
}
.notif-bell-badge {
    position: absolute;
    top: 0;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    line-height: 16px;
    border-radius: 50%;
    text-align: center;
    pointer-events: none;
}
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 9999;
    display: none;
    overflow: hidden;
}
[dir="rtl"] .notif-dropdown {
    left: auto;
    right: 0;
}
.notif-dropdown.open {
    display: block;
    animation: notifSlideIn 0.15s ease-out;
}
@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.notif-dropdown-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.notif-dropdown-readall {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.notif-dropdown-readall:hover {
    background: var(--primary-bg);
}
.notif-dropdown-list {
    max-height: 380px;
    overflow-y: auto;
}
.notif-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}
.notif-dropdown-item:last-child {
    border-bottom: none;
}
.notif-dropdown-item:hover {
    background: var(--bg-secondary);
}
.notif-dropdown-item.unread {
    background: var(--primary-bg);
}
.notif-dropdown-item.unread:hover {
    background: var(--bg-secondary);
}
.notif-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}
.notif-item-body {
    flex: 1;
    min-width: 0;
}
.notif-item-msg {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
}
.notif-dropdown-item.unread .notif-item-msg {
    font-weight: 600;
}
.notif-item-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.notif-dropdown-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}
.notif-dropdown-footer {
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    transition: background 0.15s;
}
.notif-dropdown-footer:hover {
    background: var(--bg-secondary);
}
@media (max-width: 480px) {
    .notif-dropdown {
        width: calc(100vw - 24px);
        left: 50%;
        transform: translateX(-50%);
    }
    [dir="rtl"] .notif-dropdown {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    .notif-dropdown.open {
        animation: none;
    }
}

/* Storefront widget mobile fixes */
.widget-countdown .countdown-grid {
    flex-wrap: wrap;
}
@media (max-width: 768px) {
    .widget-hero {
        padding: 40px 0 !important;
    }
    .widget-hero h2 {
        font-size: 26px !important;
    }
    .widget-hero p {
        font-size: 15px !important;
    }
    .widget-hero .btn {
        padding: 10px 24px !important;
        font-size: 14px !important;
    }
    .widget-countdown .countdown-number {
        font-size: 28px !important;
    }
    .widget-countdown .countdown-separator {
        font-size: 24px !important;
    }
    .widget-countdown .countdown-label {
        font-size: 11px !important;
    }
    .widget-banner .banner-card {
        padding: 32px !important;
    }
    .widget-banner h2 {
        font-size: 22px !important;
    }
    .widget-banner p {
        font-size: 14px !important;
    }
    .widget-newsletter .newsletter-form {
        flex-wrap: wrap;
    }
    .widget-newsletter .newsletter-input,
    .widget-newsletter .newsletter-button {
        width: 100%;
    }
    .widget-featured-category .product-grid,
    .widget-selected-products .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .store-banner {
        padding: 36px 0;
    }
    .store-banner h1 {
        font-size: 28px;
    }
    .store-banner p {
        font-size: 14px;
    }
    #widget-search-input {
        min-width: 120px !important;
    }
}
@media (max-width: 480px) {
    .widget-hero {
        padding: 32px 0 !important;
    }
    .widget-hero h2 {
        font-size: 22px !important;
    }
    .widget-hero p {
        font-size: 14px !important;
    }
    .widget-countdown .countdown-number {
        font-size: 24px !important;
    }
    .widget-countdown .countdown-separator {
        font-size: 20px !important;
    }
    .widget-banner .banner-card {
        padding: 24px !important;
    }
    .widget-featured-category .product-grid,
    .widget-selected-products .product-grid {
        grid-template-columns: 1fr !important;
    }
    .store-banner h1 {
        font-size: 24px;
    }
    .header-search-form {
        width: 100%;
    }
    #widget-search-input {
        min-width: 0 !important;
        width: 100% !important;
    }
}
