/* SP Elline Shop - manage products styles */
.sp-elline-manage {
    direction: rtl;
    font-family: 'Heebo', 'Assistant', system-ui, sans-serif;
    color: #1f2937;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}
.sp-elline-manage * { box-sizing: border-box; }

.sp-manage-header {
    text-align: center;
    margin-bottom: 20px;
}

/* ===== Back-to-home button ===== */
.sp-page-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 16px;
}
.sp-back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #be185d;
    padding: 10px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    border: 2px solid #fbcfe8;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-family: inherit;
}
.sp-back-home:hover,
.sp-back-home:focus {
    background: #fce7f3;
    color: #831843;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(236, 72, 153, 0.22);
    text-decoration: none;
}
.sp-back-home:active { transform: scale(0.97); }
.sp-back-home .sp-btn-icon {
    font-size: 18px;
    line-height: 1;
    background: #fdf2f8;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 480px) {
    .sp-back-home { padding: 8px 14px; font-size: 14px; }
    .sp-back-home .sp-btn-icon { width: 26px; height: 26px; font-size: 16px; }
}

/* ===== Tabs ===== */
.sp-manage-tabs {
    display: flex;
    gap: 6px;
    margin: 0 auto 22px;
    background: #fff;
    padding: 6px;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.12);
    border: 2px solid #fce7f3;
    max-width: 480px;
    overflow: hidden;
}
.sp-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 12px 18px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    color: #6b5063;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}
.sp-tab:hover { background: #fdf2f8; }
.sp-tab.is-active {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: #fff;
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.32);
}
.sp-tab-icon { font-size: 20px; line-height: 1; }
.sp-tab-badge {
    background: #fbbf24;
    color: #78350f;
    border-radius: 999px;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}
.sp-tab.is-active .sp-tab-badge {
    background: #fff;
    color: #be185d;
}
.sp-tab-panel { display: none; }
.sp-tab-panel.is-active { display: block; }

@media (max-width: 480px) {
    .sp-tab { padding: 10px 12px; font-size: 14px; gap: 5px; }
    .sp-tab-icon { font-size: 18px; }
}

/* ===== Orders tab ===== */
.sp-orders-section {
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    border: 3px solid #fdf2f8;
}
.sp-orders-section h3 {
    margin: 0 0 18px;
    color: #ec4899;
    font-size: 22px;
}
.sp-orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.sp-order-card {
    position: relative;
    background: linear-gradient(135deg, #fff5fa 0%, #faf0ff 100%);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.1);
    border: 2px solid #fbcfe8;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sp-order-delete {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #fbcfe8;
    background: rgba(255, 255, 255, 0.85);
    color: #9d6c84;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    font-family: inherit;
}
.sp-order-delete:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
    transform: scale(1.08);
}
.sp-order-delete:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}
.sp-order-head { padding-left: 42px; }
.sp-order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.18);
}
.sp-order-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 2px dashed #fbcfe8;
}
.sp-order-customer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    color: #1f2937;
}
.sp-order-customer strong { color: #be185d; }
.sp-order-emoji {
    font-size: 22px;
    background: #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sp-order-date {
    font-size: 13px;
    color: #9d6c84;
    background: #fff;
    padding: 4px 10px;
    border-radius: 999px;
}
.sp-order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.sp-order-chip {
    background: #fff;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 14px;
    color: #4a2c3f;
    border: 1px solid #fbcfe8;
}
.sp-order-chip strong { color: #be185d; }
.sp-order-chip--notes { background: #fef3c7; border-color: #fcd34d; }
.sp-order-items {
    list-style: none;
    padding: 12px 14px;
    margin: 0 0 12px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #fce7f3;
}
.sp-order-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed #fbcfe8;
    align-items: center;
}
.sp-order-item:last-child { border-bottom: none; }
.sp-order-item-name { font-weight: 600; color: #4a2c3f; }
.sp-order-item-qty { color: #9d6c84; font-weight: 700; }
.sp-order-item-price { color: #be185d; font-weight: 700; font-variant-numeric: tabular-nums; }
.sp-order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 16px;
    color: #78350f;
}
.sp-order-total strong { font-size: 20px; color: #d97706; }

@media (max-width: 480px) {
    .sp-order-card { padding: 14px; }
    .sp-order-customer { font-size: 16px; }
    .sp-order-item { grid-template-columns: 1fr auto; }
    .sp-order-item-qty { grid-row: 1; }
    .sp-order-item-price { grid-column: 1 / -1; text-align: left; }
}

/* ===== Orders summary card ===== */
.sp-orders-summary {
    background: linear-gradient(135deg, #fff5fa 0%, #ede9fe 100%);
    border-radius: 18px;
    padding: 16px 22px;
    margin-bottom: 22px;
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.12);
    border: 2px solid #fbcfe8;
}
.sp-orders-summary h3 { margin: 0 0 10px; color: #be185d; font-size: 18px; }
.sp-summary-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #4a2c3f;
}
.sp-summary-counts span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fdf2f8;
    padding: 4px 10px;
    border-radius: 999px;
}
.sp-summary-counts strong { font-size: 15px; color: #be185d; }
.sp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.sp-dot--delivered { background: #22c55e; }
.sp-dot--pending   { background: #f59e0b; }
.sp-dot--cancelled { background: #9ca3af; }

/* ===== Order status border accent ===== */
.sp-order-card--delivered { border-color: #bbf7d0; }
.sp-order-card--pending   { border-color: #fde68a; }
.sp-order-card--cancelled { border-color: #e5e7eb; opacity: 0.78; }
.sp-order-card--cancelled .sp-order-customer strong { text-decoration: line-through; }

/* ===== CRM section in order card ===== */
.sp-order-crm {
    border-top: 2px dashed #fbcfe8;
    padding-top: 12px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sp-order-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sp-status-pill {
    flex: 1;
    min-width: 110px;
    border: 2px solid transparent;
    background: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    color: #6b5063;
    transition: all 0.15s ease;
}
.sp-status-pill:hover { transform: translateY(-1px); }
.sp-status-pill--delivered.is-active { background: #22c55e; color: #fff; border-color: #16a34a; box-shadow: 0 4px 12px rgba(34,197,94,0.32); }
.sp-status-pill--pending.is-active   { background: #f59e0b; color: #fff; border-color: #d97706; box-shadow: 0 4px 12px rgba(245,158,11,0.32); }
.sp-status-pill--cancelled.is-active { background: #6b7280; color: #fff; border-color: #4b5563; box-shadow: 0 4px 12px rgba(107,114,128,0.32); }

.sp-order-msg {
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    min-height: 18px;
}
.sp-order-msg.is-error { color: #dc2626; }
.sp-order-msg.is-success { color: #16a34a; }

@media (max-width: 480px) {
    .sp-status-pill { min-width: 0; flex: 1 1 calc(33% - 4px); font-size: 13px; padding: 8px 6px; }
}
.sp-manage-header h2 {
    color: #a855f7;
    font-size: 28px;
    margin: 0 0 8px;
}
.sp-manage-header p {
    margin: 0;
    color: #6b7280;
    font-size: 16px;
}

.sp-add-product-section,
.sp-products-section {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    border: 3px solid #fdf2f8;
}

.sp-add-product-section h3,
.sp-products-section h3 {
    margin: 0 0 16px;
    color: #ec4899;
    font-size: 22px;
}

.sp-product-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 500px;
}
.sp-product-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    font-size: 15px;
}
.sp-product-form input[type="text"],
.sp-product-form input[type="number"] {
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
}
.sp-product-form input:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.sp-image-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sp-image-picker > span {
    font-weight: 600;
    font-size: 15px;
}
.sp-image-preview {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1;
    border: 2px dashed #d1d5db;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
}
.sp-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sp-image-placeholder {
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
    padding: 8px;
}

/* ===== Native file picker (mobile-friendly) ===== */
.sp-file-label {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sp-file-label:hover { transform: translateY(-1px); }
.sp-file-label:active { transform: scale(0.97); }
.sp-file-label.is-disabled,
.sp-file-label[disabled] { opacity: 0.6; pointer-events: none; }
.sp-file-label input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}
.sp-file-icon {
    font-size: 22px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sp-file-text { font-weight: 700; }

.sp-upload-progress {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fdf2f8;
    color: #be185d;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 999px;
    margin-top: 6px;
    align-self: flex-start;
}
.sp-upload-progress[hidden] { display: none; }
.sp-upload-spinner {
    display: inline-block;
    animation: sp-spin 1.2s linear infinite;
}
@keyframes sp-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Slightly larger touch targets on mobile */
@media (max-width: 480px) {
    .sp-file-label { padding: 14px 20px; font-size: 16px; min-height: 50px; }
    .sp-file-icon { width: 34px; height: 34px; font-size: 24px; }
    .sp-image-preview { max-width: 100%; }
}

.sp-btn-primary,
.sp-btn-secondary,
.sp-btn-edit,
.sp-btn-delete {
    border: none;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sp-btn-primary {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: #fff;
    align-self: flex-start;
}
.sp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.4);
}
.sp-btn-primary:disabled { opacity: 0.6; cursor: wait; }

.sp-btn-secondary {
    background: #fce7f3;
    color: #831843;
    align-self: flex-start;
}
.sp-btn-secondary:hover { background: #fbcfe8; }

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

.sp-manage-card {
    background: linear-gradient(135deg, #fdf2f8, #ede9fe);
    border-radius: 18px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 2px solid #f9a8d4;
}
.sp-manage-image {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-manage-image img { width: 100%; height: 100%; object-fit: cover; }

.sp-manage-card h4 {
    margin: 0;
    text-align: center;
    font-size: 16px;
}
.sp-manage-card .sp-price {
    text-align: center;
    color: #ec4899;
    font-weight: 800;
    font-size: 18px;
}

.sp-manage-card .sp-stock {
    text-align: center;
    font-size: 13px;
    color: #166534;
    background: #dcfce7;
    border-radius: 999px;
    padding: 4px 12px;
    align-self: center;
    font-weight: 600;
}
.sp-manage-card .sp-stock-out {
    color: #991b1b;
}
.sp-manage-card .sp-stock:has(.sp-stock-out) { background: #fee2e2; }

.sp-field-hint {
    display: block;
    color: #9d6c84;
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.sp-card-actions {
    display: flex;
    gap: 8px;
}
.sp-btn-edit,
.sp-btn-delete {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
}
.sp-btn-edit {
    background: #dbeafe;
    color: #1e40af;
}
.sp-btn-edit:hover { background: #bfdbfe; }

.sp-btn-delete {
    background: #fee2e2;
    color: #991b1b;
}
.sp-btn-delete:hover { background: #fecaca; }

/* No access */
.sp-elline-no-access {
    direction: rtl;
    text-align: center;
    background: #fef3c7;
    border-radius: 20px;
    padding: 40px 20px;
    border: 3px solid #fcd34d;
    max-width: 600px;
    margin: 20px auto;
    font-family: 'Heebo', system-ui, sans-serif;
}
.sp-elline-no-access h3 { font-size: 24px; color: #b45309; margin: 0 0 10px; }

/* Modal */
.sp-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-modal[hidden] { display: none; }
.sp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}
.sp-modal-content {
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    width: min(500px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    direction: rtl;
}
.sp-modal-content header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.sp-modal-content header h3 { margin: 0; color: #a855f7; }
.sp-modal-close {
    background: #fce7f3;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}

.sp-form-message {
    text-align: center;
    font-weight: 700;
    margin-top: 6px;
}
.sp-form-message.is-error { color: #dc2626; }
.sp-form-message.is-success { color: #16a34a; }

@media (max-width: 480px) {
    .sp-manage-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

/* ===== Login form ===== */
.sp-elline-login {
    direction: rtl;
    font-family: 'Heebo', 'Assistant', system-ui, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 30px 16px;
}
.sp-login-card {
    background: linear-gradient(180deg, #fff5fa 0%, #ffe5f1 100%);
    border-radius: 28px;
    padding: 36px 30px;
    box-shadow: 0 20px 60px rgba(236, 72, 153, 0.18);
    border: 3px solid #fbcfe8;
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.sp-login-card::before,
.sp-login-card::after {
    content: "";
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.6;
    pointer-events: none;
}
.sp-login-card::before {
    top: -30px; left: -30px;
    background: radial-gradient(circle, #fce7f3, transparent 70%);
}
.sp-login-card::after {
    bottom: -30px; right: -30px;
    background: radial-gradient(circle, #ede9fe, transparent 70%);
}
.sp-login-emoji {
    font-size: 64px;
    margin-bottom: 6px;
    animation: sp-login-bounce 2.4s ease-in-out infinite;
}
@keyframes sp-login-bounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50%      { transform: translateY(-6px) rotate(5deg); }
}
.sp-login-card h2 {
    margin: 4px 0 6px;
    color: #ec4899;
    font-size: 28px;
}
.sp-login-card > p {
    margin: 0 0 18px;
    color: #6b5063;
    font-size: 15px;
}
.sp-login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: right;
}
.sp-login-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
    font-size: 15px;
    color: #4a2c3f;
}
.sp-login-form input[type="text"],
.sp-login-form input[type="password"] {
    padding: 14px 16px;
    border-radius: 14px;
    border: 2px solid #fbcfe8;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sp-login-form input:focus {
    outline: none;
    border-color: #ec4899;
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.18);
}
.sp-login-remember {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    color: #6b5063 !important;
    cursor: pointer;
}
.sp-login-remember input { width: 18px; height: 18px; accent-color: #ec4899; }
.sp-login-submit {
    background: linear-gradient(135deg, #ec4899, #a855f7);
    color: #fff;
    border: none;
    padding: 16px 28px;
    border-radius: 999px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    margin-top: 6px;
    box-shadow: 0 8px 22px rgba(236, 72, 153, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sp-login-submit:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(236, 72, 153, 0.45); }
.sp-login-submit:active { transform: scale(0.97); }
.sp-login-error {
    background: #fee2e2;
    border-radius: 12px;
    padding: 10px 14px;
    color: #991b1b;
    font-weight: 700;
    text-align: center;
    font-size: 14px;
}
.sp-login-help {
    margin-top: 18px;
    color: #9d6c84;
    font-size: 13px;
}

