/* ==========================================================================
   عطور عساف | Assaf Perfumes - لوحة تحكم إدارة المخزون (Sold Out / In Stock)
   تصميم فاخر بنمط الرخام والذهب والأسود الأوبسيديان
   ========================================================================== */

/* --- 1. Footer Admin Trigger Button --- */
.footer-admin-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 18px auto 0;
    position: relative;
    z-index: 5;
}

.footer-admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(197, 160, 89, 0.08);
    border: 1px solid rgba(197, 160, 89, 0.28);
    color: #e5c483;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.footer-admin-btn:hover {
    background: rgba(197, 160, 89, 0.18);
    border-color: rgba(197, 160, 89, 0.6);
    color: #faecc5;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(197, 160, 89, 0.2);
}

.footer-admin-btn .admin-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* --- 2. Admin Stock Modal Backdrop & Dialog --- */
.admin-stock-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(3, 4, 7, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
    direction: rtl;
    box-sizing: border-box;
}

.admin-stock-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.admin-stock-dialog {
    position: relative;
    width: 100%;
    max-width: 780px;
    max-height: 88vh;
    background: radial-gradient(110% 80% at 85% 10%, rgba(197, 160, 89, 0.09) 0%, transparent 60%),
                linear-gradient(180deg, #10131a 0%, #07080c 100%);
    border: 1.5px solid rgba(197, 160, 89, 0.45);
    border-radius: 24px;
    box-shadow: 0 35px 80px -10px rgba(0, 0, 0, 0.95),
                0 0 45px rgba(197, 160, 89, 0.16),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 20px 24px 20px;
    color: #ffffff;
    transform: scale(0.96) translateY(12px);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s;
    opacity: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-stock-backdrop.active .admin-stock-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal Header */
.admin-stock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.admin-header-title-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-badge-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #e5c483;
    box-shadow: 0 0 12px #e5c483;
    flex-shrink: 0;
}

.admin-title {
    font-size: 16px;
    font-weight: 800;
    color: #faecc5;
    margin: 0;
}

.admin-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin: 2px 0 0;
}

.admin-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.admin-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ffffff;
    transform: rotate(90deg);
}

/* Bar of Controls (Search + Stats + Reset) */
.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0 12px;
    flex-shrink: 0;
}

.admin-search-wrap {
    flex: 1;
    min-width: 220px;
    position: relative;
}

.admin-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(197, 160, 89, 0.25);
    border-radius: 12px;
    padding: 9px 38px 9px 14px;
    color: #ffffff;
    font-size: 13.5px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.admin-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.07);
    border-color: #e5c483;
    box-shadow: 0 0 15px rgba(229, 196, 131, 0.2);
}

.admin-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    stroke: #94a3b8;
    pointer-events: none;
}

.admin-stats-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-pill {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.stat-pill.in-stock-pill {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #4ade80;
}

.stat-pill.sold-out-pill {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.admin-reset-all-btn {
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.admin-reset-all-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: #e5c483;
}

/* Scrollable Perfumes List */
.admin-perfumes-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    margin: 4px 0 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(88vh - 190px);
}

/* Custom Scrollbar */
.admin-perfumes-scroll::-webkit-scrollbar {
    width: 5px;
}
.admin-perfumes-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}
.admin-perfumes-scroll::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.3);
    border-radius: 10px;
}
.admin-perfumes-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(197, 160, 89, 0.6);
}

/* Single Perfume Item Row in Admin */
.admin-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 10px 14px;
    transition: all 0.25s ease;
}

.admin-item-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(197, 160, 89, 0.25);
}

.admin-item-row.is-sold-out {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.04);
}

.admin-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.admin-item-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #0d0e14;
    border: 1px solid rgba(197, 160, 89, 0.2);
    object-fit: cover;
    flex-shrink: 0;
}

.admin-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-item-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-item-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.admin-item-price {
    color: #e5c483;
    font-weight: 600;
}

/* Status Badge inside row */
.admin-item-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.admin-item-badge.badge-available {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.admin-item-badge.badge-soldout {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Two Action Buttons per Item */
.admin-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-stock-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    outline: none;
}

/* "متوفر" Button */
.btn-toggle-available {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-toggle-available:hover {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.btn-toggle-available.active {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    color: #ffffff;
    border-color: #22c55e;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

/* "Sold Out" Button */
.btn-toggle-soldout {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-toggle-soldout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-toggle-soldout.active {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

/* Modal Bottom Status Bar */
.admin-stock-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    font-size: 12.5px;
    color: #94a3b8;
}

.admin-sync-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4ade80;
    font-weight: 600;
}

.admin-sync-hint .sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.admin-done-btn {
    background: linear-gradient(135deg, #c5a059 0%, #a37c35 100%);
    color: #0b0c10;
    font-weight: 800;
    padding: 8px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.25s ease;
}

.admin-done-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(197, 160, 89, 0.35);
}

/* --- 3. Sold Out Styling on Main Page Perfume Cards --- */
.perfume-card.is-sold-out {
    position: relative;
    opacity: 0.82;
    transition: opacity 0.3s ease;
}

.perfume-card.is-sold-out .card-circle-wrap img {
    filter: grayscale(40%) contrast(90%);
}

/* Sold Out Floating Ribbon / Badge on Perfume Card */
.perfume-card .card-sold-out-badge {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.45);
    z-index: 10;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    animation: pulseBadge 2.2s infinite;
}

.perfume-card.is-sold-out .card-sold-out-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

@keyframes pulseBadge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Disabled '+' Card Button for Sold Out Perfume */
.perfume-card.is-sold-out .card-plus-btn {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #f87171 !important;
    cursor: not-allowed !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    width: auto !important;
    padding: 4px 10px !important;
    border-radius: 8px !important;
}

.perfume-card.is-sold-out .card-plus-btn::after {
    content: "نفد";
}

/* --- 4. Sold Out Styling in the Order Modal Catalog --- */
.catalog-item-row.is-sold-out {
    opacity: 0.65;
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.2);
}

.catalog-item-row.is-sold-out .item-thumb-img {
    filter: grayscale(50%);
}

.btn-item-sold-out {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    font-size: 11.5px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: not-allowed;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Toast Message */
.stock-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: #11141c;
    border: 1px solid rgba(197, 160, 89, 0.4);
    color: #faecc5;
    padding: 10px 20px;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    font-size: 13.5px;
    font-weight: 700;
    z-index: 1000000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    direction: rtl;
}

.stock-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .admin-stock-dialog {
        padding: 16px;
        max-height: 94vh;
        border-radius: 18px;
    }
    .admin-item-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .admin-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .btn-stock-toggle {
        flex: 1;
        justify-content: center;
    }
}

/* --- 5. Admin Login Modal --- */
.admin-login-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: rgba(3, 4, 7, 0.9);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
    direction: rtl;
    box-sizing: border-box;
}

.admin-login-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.admin-login-dialog {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: radial-gradient(110% 80% at 85% 10%, rgba(197, 160, 89, 0.12) 0%, transparent 60%),
                linear-gradient(180deg, #12151e 0%, #07080c 100%);
    border: 1.5px solid rgba(197, 160, 89, 0.5);
    border-radius: 24px;
    box-shadow: 0 35px 80px -10px rgba(0, 0, 0, 0.95),
                0 0 50px rgba(197, 160, 89, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
    padding: 28px 26px 26px;
    color: #ffffff;
    transform: scale(0.95) translateY(12px);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s;
    opacity: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.admin-login-backdrop.active .admin-login-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Shake animation on invalid login */
.admin-login-dialog.shake {
    animation: adminShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes adminShake {
    10%, 90% { transform: translate3d(-3px, 0, 0); }
    20%, 80% { transform: translate3d(5px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
    40%, 60% { transform: translate3d(5px, 0, 0); }
}

.login-header-icon-wrap {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: rgba(197, 160, 89, 0.12);
    border: 1.5px solid rgba(197, 160, 89, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e5c483;
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.25);
}

.login-header-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.login-title {
    font-size: 18px;
    font-weight: 800;
    color: #faecc5;
    text-align: center;
    margin: 0 0 4px;
}

.login-subtitle {
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    margin: 0 0 20px;
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-label {
    font-size: 12.5px;
    font-weight: 700;
    color: #e5c483;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(197, 160, 89, 0.3);
    border-radius: 12px;
    padding: 12px 42px 12px 14px;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.login-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.09);
    border-color: #e5c483;
    box-shadow: 0 0 16px rgba(229, 196, 131, 0.28);
}

.login-field-icon {
    position: absolute;
    right: 14px;
    width: 17px;
    height: 17px;
    stroke: #94a3b8;
    pointer-events: none;
}

.login-toggle-eye {
    position: absolute;
    left: 12px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.login-toggle-eye:hover {
    color: #e5c483;
}

.login-error-msg {
    display: none;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    font-size: 12.5px;
    font-weight: 600;
    padding: 9px 12px;
    border-radius: 10px;
    text-align: center;
}

.login-submit-btn {
    margin-top: 6px;
    background: linear-gradient(135deg, #c5a059 0%, #a37c35 100%);
    color: #0b0c10;
    font-weight: 800;
    font-size: 14.5px;
    font-family: inherit;
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 6px 20px rgba(197, 160, 89, 0.3);
}

.login-submit-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(197, 160, 89, 0.45);
}

.login-close-corner {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.login-close-corner:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ffffff;
}

/* Logout button in stock header */
.admin-logout-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.admin-logout-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ffffff;
}

