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

html {
    direction: rtl;
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family:
        Tahoma,
        Arial,
        sans-serif;

    background: #f7f7f9;
    color: #222;

    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

a {
    text-decoration: none;
}


/* =====================================================
   LAYOUT
===================================================== */

.admin-layout {
    width: 100%;
    min-height: 100vh;
}


/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {
    position: fixed;

    top: 0;
    right: 0;

    width: 255px;
    height: 100vh;

    background: #fff;

    border-left: 1px solid #eee;

    z-index: 1000;

    display: flex;
    flex-direction: column;

    transition: transform .3s ease;
}


.sidebar-header {
    min-height: 80px;

    padding: 15px 18px;

    display: flex;
    align-items: center;

    gap: 12px;

    border-bottom: 1px solid #eee;
}


.brand-icon {
    width: 45px;
    height: 45px;

    border-radius: 13px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            #ec407a,
            #c2185b
        );

    color: #fff;

    font-size: 22px;

    box-shadow:
        0 7px 20px
        rgba(236, 64, 122, .25);
}


.sidebar-header h2 {
    margin: 0;

    color: #e91e63;

    font-size: 17px;
}


.sidebar-header span {
    display: block;

    margin-top: 4px;

    color: #999;

    font-size: 10px;
}


.sidebar-menu {
    flex: 1;

    padding: 18px 12px;

    overflow-y: auto;
}


.sidebar-menu a {
    min-height: 47px;

    margin-bottom: 7px;

    padding: 10px 13px;

    display: flex;
    align-items: center;

    gap: 11px;

    border-radius: 11px;

    color: #555;

    transition:
        background .2s,
        color .2s,
        transform .2s;
}


.sidebar-menu a:hover {
    background: #fce4ec;

    color: #e91e63;

    transform: translateX(-2px);
}


.sidebar-menu a.active {
    background:
        linear-gradient(
            135deg,
            #ec407a,
            #c2185b
        );

    color: #fff;

    box-shadow:
        0 7px 20px
        rgba(236, 64, 122, .2);
}


.menu-icon {
    width: 26px;

    display: flex;

    justify-content: center;

    font-size: 18px;
}


.sidebar-footer {
    padding: 16px;

    border-top: 1px solid #eee;

    text-align: center;

    color: #999;

    font-size: 10px;
}


.sidebar-footer small {
    display: block;

    margin-top: 4px;

    font-size: 9px;
}


/* =====================================================
   MAIN
===================================================== */

.main-content {
    width: calc(100% - 255px);

    min-height: 100vh;

    margin-right: 255px;
}


/* =====================================================
   TOPBAR
===================================================== */

.topbar {
    position: sticky;

    top: 0;

    z-index: 900;

    height: 75px;

    padding: 0 25px;

    background: #fff;

    border-bottom: 1px solid #eee;

    display: flex;

    align-items: center;

    justify-content: space-between;
}


.topbar-right {
    display: flex;

    align-items: center;

    gap: 13px;
}


.topbar h1 {
    margin: 0;

    font-size: 21px;

    font-weight: 800;
}


.topbar p {
    margin-top: 5px;

    color: #999;

    font-size: 11px;
}


.topbar-left {
    display: flex;

    align-items: center;
}


.menu-toggle {
    display: none;

    width: 42px;
    height: 42px;

    border: 1px solid #eee;

    border-radius: 10px;

    background: #fff;

    font-size: 20px;
}


.logout-btn {
    border: 0;

    padding: 10px 16px;

    border-radius: 10px;

    background: #fff0f3;

    color: #d81b60;

    font-size: 12px;

    transition: .2s;
}


.logout-btn:hover {
    background: #fce4ec;
}


/* =====================================================
   PAGE
===================================================== */

.page-content {
    width: 100%;

    max-width: 1450px;

    margin: 0 auto;

    padding: 25px;
}


.breadcrumb {
    display: flex;

    align-items: center;

    gap: 7px;

    margin-bottom: 20px;

    color: #999;

    font-size: 12px;
}


.breadcrumb a {
    color: #e91e63;
}


.breadcrumb strong {
    color: #555;
}


/* =====================================================
   FORM LAYOUT
===================================================== */

.form-layout {
    width: 100%;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        330px;

    gap: 20px;

    align-items: start;
}


.form-main,
.form-sidebar {
    min-width: 0;
}


/* =====================================================
   CARDS
===================================================== */

.form-card {
    width: 100%;

    margin-bottom: 20px;

    padding: 21px;

    background: #fff;

    border: 1px solid #eee;

    border-radius: 17px;

    box-shadow:
        0 8px 30px
        rgba(0, 0, 0, .045);
}


.card-title {
    display: flex;

    align-items: center;

    gap: 10px;

    padding-bottom: 15px;

    margin-bottom: 20px;

    border-bottom: 1px solid #eee;

    font-size: 16px;

    font-weight: 800;
}


.title-icon {
    width: 36px;
    height: 36px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #fce4ec;

    font-size: 18px;
}


/* =====================================================
   FORM GRID
===================================================== */

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 17px;
}


.form-group {
    min-width: 0;
}


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


.form-group label {
    display: block;

    margin-bottom: 8px;

    color: #333;

    font-size: 12px;

    font-weight: 700;
}


.required {
    color: #e53935;
}


.input-hint {
    display: block;

    margin-top: 6px;

    color: #999;

    font-size: 10px;

    line-height: 1.7;
}


/* =====================================================
   INPUT
===================================================== */

.form-control {
    width: 100%;

    height: 46px;

    padding: 0 13px;

    border: 1px solid #ddd;

    border-radius: 10px;

    outline: none;

    background: #fff;

    color: #222;

    font-size: 13px;

    transition:
        border-color .2s,
        box-shadow .2s;
}


.form-control:focus {
    border-color: #e91e63;

    box-shadow:
        0 0 0 3px
        rgba(233, 30, 99, .09);
}


.form-control::placeholder {
    color: #aaa;
}


textarea.form-control {
    height: 130px;

    padding: 12px 13px;

    resize: vertical;

    line-height: 1.8;
}


select.form-control {
    cursor: pointer;
}


.stock-grid {
    margin-top: 17px;
}


/* =====================================================
   PRICE
===================================================== */

.price-row {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 14px;
}


.price-box {
    min-width: 0;
}


.price-box .form-group {
    position: relative;
}


.price-box .form-control {
    padding-left: 52px;
}


.currency {
    position: absolute;

    left: 11px;

    bottom: 13px;

    color: #999;

    font-size: 9px;

    pointer-events: none;
}


.discount-preview {
    display: none;

    margin-top: 16px;

    padding: 13px 15px;

    border: 1px solid #eadb9a;

    border-radius: 11px;

    background: #fffbed;

    color: #806b18;

    font-size: 12px;
}


.discount-preview.show {
    display: block;
}


#finalPricePreview {
    margin-right: 5px;

    font-weight: 800;
}


/* =====================================================
   IMAGE UPLOAD
===================================================== */

.image-upload-box {
    position: relative;

    width: 100%;

    min-height: 175px;

    overflow: hidden;

    border: 2px dashed #e8a6be;

    border-radius: 15px;

    background: #fffafd;

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    transition: .2s;
}


.image-upload-box:hover {
    border-color: #e91e63;

    background: #fff5f9;
}


.image-upload-box.dragover {
    border-color: #e91e63;

    background: #fce4ec;
}


.image-upload-box input[type="file"] {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    opacity: 0;

    cursor: pointer;

    z-index: 5;
}


.upload-content {
    pointer-events: none;
}


.upload-icon {
    margin-bottom: 8px;

    font-size: 37px;
}


.upload-title {
    color: #e91e63;

    font-size: 14px;

    font-weight: 800;
}


.upload-text {
    margin-top: 7px;

    color: #999;

    font-size: 10px;

    line-height: 1.8;
}


.image-count {
    margin-top: 10px;

    color: #999;

    font-size: 11px;
}


/* =====================================================
   IMAGE PREVIEW
===================================================== */

.image-preview-grid {
    display: grid;

    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 10px;

    margin-top: 15px;
}


.image-preview-item {
    position: relative;

    overflow: hidden;

    aspect-ratio: 1 / 1;

    border: 1px solid #ddd;

    border-radius: 12px;

    background: #f5f5f5;
}


.image-preview-item img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}


.remove-image {
    position: absolute;

    top: 5px;
    left: 5px;

    width: 27px;
    height: 27px;

    border: 0;

    border-radius: 50%;

    background: rgba(220, 38, 38, .93);

    color: #fff;

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 16px;

    z-index: 5;
}


.primary-badge {
    position: absolute;

    right: 5px;
    bottom: 5px;

    padding: 4px 7px;

    border-radius: 6px;

    background: rgba(201, 162, 39, .95);

    color: #fff;

    font-size: 8px;
}


/* =====================================================
   SPECIFICATIONS
===================================================== */

.spec-list {
    width: 100%;

    display: flex;

    flex-direction: column;

    gap: 10px;
}


.spec-row {
    display: grid;

    grid-template-columns:
        1fr
        1fr
        42px;

    gap: 9px;

    align-items: center;
}


.remove-spec {
    width: 42px;
    height: 42px;

    border: 1px solid #fecaca;

    border-radius: 10px;

    background: #fff5f5;

    color: #dc2626;

    font-size: 20px;

    line-height: 1;
}


.add-spec-btn {
    margin-top: 12px;

    min-height: 42px;

    padding: 0 15px;

    border: 1px dashed #e91e63;

    border-radius: 10px;

    background: #fff8fb;

    color: #e91e63;

    font-size: 12px;

    font-weight: 700;
}


.add-spec-btn:hover {
    background: #fce4ec;
}


/* =====================================================
   SWITCH
===================================================== */

.switch-list {
    display: flex;

    flex-direction: column;

    gap: 11px;
}


.switch-item {
    min-height: 70px;

    padding: 12px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    border: 1px solid #eee;

    border-radius: 12px;

    background: #fff;
}


.switch-info {
    min-width: 0;
}


.switch-info strong {
    display: block;

    color: #333;

    font-size: 12px;
}


.switch-info small {
    display: block;

    margin-top: 5px;

    color: #999;

    font-size: 9px;

    line-height: 1.6;
}


.switch {
    position: relative;

    width: 46px;
    height: 26px;

    flex-shrink: 0;
}


.switch input {
    position: absolute;

    opacity: 0;

    width: 0;
    height: 0;
}


.slider {
    position: absolute;

    inset: 0;

    border-radius: 30px;

    background: #d1d5db;

    transition: .25s;

    cursor: pointer;
}


.slider::before {
    content: "";

    position: absolute;

    width: 20px;
    height: 20px;

    right: 3px;
    top: 3px;

    border-radius: 50%;

    background: #fff;

    box-shadow:
        0 2px 5px
        rgba(0, 0, 0, .18);

    transition: .25s;
}


.switch input:checked + .slider {
    background: #e91e63;
}


.switch input:checked + .slider::before {
    transform: translateX(-20px);
}


/* =====================================================
   HELP
===================================================== */

.help-card ul {
    padding-right: 19px;
}


.help-card li {
    margin-bottom: 9px;

    color: #777;

    font-size: 10px;

    line-height: 1.8;
}


.help-card li:last-child {
    margin-bottom: 0;
}


/* =====================================================
   ACTION
===================================================== */

.action-card {
    display: flex;

    flex-direction: column;

    gap: 10px;
}


.btn {
    width: 100%;

    min-height: 46px;

    border: 0;

    border-radius: 11px;

    display: flex;

    align-items: center;
    justify-content: center;

    gap: 8px;

    font-size: 12px;

    font-weight: 700;

    transition: .2s;
}


.btn-primary {
    background:
        linear-gradient(
            135deg,
            #ec407a,
            #c2185b
        );

    color: #fff;

    box-shadow:
        0 7px 20px
        rgba(236, 64, 122, .2);
}


.btn-primary:hover {
    transform: translateY(-1px);
}


.btn-secondary {
    border: 1px solid #ddd;

    background: #f5f5f7;

    color: #555;
}


.btn-secondary:hover {
    background: #eee;
}


/* =====================================================
   ERROR
===================================================== */

.form-error {
    display: none;

    width: 100%;

    margin-bottom: 17px;

    padding: 12px 15px;

    border: 1px solid #fecdd3;

    border-radius: 11px;

    background: #fff1f2;

    color: #dc2626;

    font-size: 12px;

    line-height: 1.8;
}


.form-error.show {
    display: block;
}


/* =====================================================
   TOAST
===================================================== */

.toast-container {
    position: fixed;

    left: 20px;
    bottom: 20px;

    z-index: 5000;

    width: min(380px, calc(100% - 40px));

    display: flex;

    flex-direction: column;

    gap: 9px;
}


.toast {
    padding: 13px 15px;

    border-radius: 11px;

    background: #fff;

    border: 1px solid #eee;

    box-shadow:
        0 10px 35px
        rgba(0, 0, 0, .14);

    color: #333;

    font-size: 12px;

    animation: toastIn .25s ease;
}


.toast.success {
    border-right: 4px solid #16a34a;
}


.toast.error {
    border-right: 4px solid #dc2626;
}


.toast.warning {
    border-right: 4px solid #d97706;
}


@keyframes toastIn {

    from {
        opacity: 0;

        transform:
            translateY(15px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }

}


/* =====================================================
   LOADING
===================================================== */

.loading-overlay {
    position: fixed;

    inset: 0;

    z-index: 6000;

    display: none;

    align-items: center;
    justify-content: center;

    background:
        rgba(255, 255, 255, .82);

    backdrop-filter: blur(4px);
}


.loading-overlay.show {
    display: flex;
}


.loading-box {
    min-width: 180px;

    padding: 25px;

    border-radius: 16px;

    background: #fff;

    box-shadow:
        0 15px 50px
        rgba(0, 0, 0, .15);

    text-align: center;

    color: #444;

    font-size: 12px;
}


.spinner {
    width: 35px;
    height: 35px;

    margin: 0 auto 12px;

    border: 4px solid #f8cbdc;

    border-top-color: #e91e63;

    border-radius: 50%;

    animation:
        spin .8s linear infinite;
}


@keyframes spin {

    to {
        transform: rotate(360deg);
    }

}


/* =====================================================
   OVERLAY MOBILE
===================================================== */

.sidebar-overlay {
    position: fixed;

    inset: 0;

    z-index: 999;

    display: none;

    background:
        rgba(0, 0, 0, .45);
}


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


/* =====================================================
   TABLET
===================================================== */

@media (max-width: 1100px) {

    .form-layout {
        grid-template-columns: 1fr;
    }

    .form-sidebar {
        display: grid;

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 20px;
    }

    .form-sidebar .form-card {
        margin-bottom: 0;
    }

    .action-card {
        height: fit-content;
    }

}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 800px) {

    .sidebar {
        transform:
            translateX(100%);
    }

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


    .main-content {
        width: 100%;

        margin-right: 0;
    }


    .menu-toggle {
        display: flex;

        align-items: center;
        justify-content: center;
    }


    .topbar {
        height: 65px;

        padding: 0 14px;
    }


    .topbar h1 {
        font-size: 17px;
    }


    .topbar p {
        display: none;
    }


    .page-content {
        padding: 14px;
    }


    .form-sidebar {
        display: block;
    }


    .form-sidebar .form-card {
        margin-bottom: 15px;
    }


    .form-card {
        padding: 15px;

        border-radius: 14px;
    }


    .form-grid {
        grid-template-columns: 1fr;
    }


    .form-group.full {
        grid-column: auto;
    }


    .price-row {
        grid-template-columns: 1fr;
    }


    .image-preview-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }


    .spec-row {
        grid-template-columns:
            1fr 1fr;
    }


    .spec-row .remove-spec {
        width: 100%;

        grid-column: 1 / -1;
    }


    .toast-container {
        left: 10px;
        right: 10px;

        bottom: 10px;

        width: auto;
    }

}


/* =====================================================
   SMALL MOBILE
===================================================== */

@media (max-width: 480px) {

    .topbar h1 {
        font-size: 15px;
    }


    .page-content {
        padding: 10px;
    }


    .form-card {
        padding: 13px;
    }


    .image-preview-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }


    .image-upload-box {
        min-height: 150px;
    }


    .upload-icon {
        font-size: 30px;
    }


    .upload-title {
        font-size: 13px;
    }

}


/* =====================================================
   DARK MODE
===================================================== */

@media (prefers-color-scheme: dark) {

    body {
        background: #111114;

        color: #f4f4f5;
    }


    .sidebar {
        background: #1a1a1f;

        border-color: #303038;
    }


    .sidebar-header,
    .sidebar-footer {
        border-color: #303038;
    }


    .sidebar-menu a {
        color: #c4c4cc;
    }


    .sidebar-menu a:hover {
        background: #33202a;

        color: #ff6b9d;
    }


    .topbar {
        background: #1b1b20;

        border-color: #303038;
    }


    .menu-toggle {
        background: #24242a;

        border-color: #38383f;

        color: #fff;
    }


    .form-card {
        background: #1b1b20;

        border-color: #303038;

        box-shadow:
            0 8px 30px
            rgba(0, 0, 0, .2);
    }


    .card-title {
        border-color: #303038;
    }


    .form-group label {
        color: #eee;
    }


    .form-control {
        background: #24242a;

        border-color: #38383f;

        color: #f5f5f5;
    }
