/* Common Buttons */
.btn-primary {
    background: linear-gradient(135deg,
            var(--primary) 0%,
            var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 0.55rem 1.25rem;
    border-radius: var(--radius-lg);
    min-height: 40px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(var(--shadow-color), 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 16px rgba(var(--shadow-color), 0.4);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

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

body.dark-mode .btn-icon:hover {
    background-color: #334155;
    color: var(--primary);
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
}

.btn-lang-selector {
    background: var(--card-bg);
    border: 1.5px solid var(--primary);
    color: var(--primary-dark);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.btn-lang-selector:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--shadow-color), 0.2);
}

.btn-lang-selector i:last-child {
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.lang-dropdown.is-open .btn-lang-selector i:last-child {
    transform: rotate(180deg);
}

.lang-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--card-bg);
    border-radius: 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    overflow: hidden;
    z-index: 1000;
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    border: 1px solid rgba(var(--shadow-color), 0.1);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

body.dark-mode .lang-menu {
    background: rgba(44, 24, 16, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

.lang-menu.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

[dir="rtl"] .lang-menu {
    right: auto;
    left: 0;
}

.lang-item {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-main);
    text-align: left;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

[dir="rtl"] .lang-item {
    text-align: right;
}

.lang-item:hover {
    background: var(--primary);
    color: white;
}

.lang-item.active {
    background: rgba(var(--shadow-color), 0.05);
    color: var(--primary);
}

.lang-flag {
    font-size: 0.75rem;
    background: rgba(var(--shadow-color), 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    color: var(--primary);
}

.lang-item:hover .lang-flag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

[dir="rtl"] .toast-container {
    right: auto;
    left: 2rem;
}

.toast {
    background: var(--card-bg);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    border-left: 4px solid var(--primary);
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[dir="rtl"] .toast {
    border-left: none;
    border-right: 4px solid var(--primary);
    animation: slideInLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.error {
    border-color: #ef4444;
}

.toast.success {
    border-color: #10b981;
}

.toast i {
    font-size: 1.25rem;
}

.toast.error i {
    color: #ef4444;
}

.toast.success i {
    color: #10b981;
}

@media (max-width: 768px) {
    .toast-container {
        top: 1rem;
        bottom: auto;
        right: 1rem;
        left: 1rem;
        align-items: stretch;
    }

    .toast {
        min-width: auto;
        width: 100%;
        animation: slideInDown 0.3s ease-out;
    }
}

.toast.fade-out {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

/* Item Counter (Admin Only) */
.item-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(var(--shadow-color), 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.item-counter.hidden {
    display: none;
}

.item-counter i {
    font-size: 1.1rem;
}

#item-count {
    font-size: 1.25rem;
    font-family: var(--font-en);
    letter-spacing: 0.5px;
    min-width: 24px;
    text-align: center;
}

.counter-label {
    font-size: 0.85rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .item-counter {
        padding: 0.4rem 0.75rem;
        gap: 0.4rem;
    }

    #item-count {
        font-size: 1rem;
        min-width: 20px;
    }

    .counter-label {
        font-size: 0.75rem;
    }

    .item-counter i {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .counter-label {
        display: none;
    }

    .item-counter {
        padding: 0.4rem 0.6rem;
        min-width: 60px;
        justify-content: center;
    }
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 8px 20px rgba(var(--shadow-color), 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    opacity: 1;
    transform: scale(1);
}

.scroll-to-top.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.scroll-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 12px 28px rgba(var(--shadow-color), 0.5);
}

.scroll-to-top:active {
    transform: translateY(-3px) scale(1.05);
}

.scroll-to-top i {
    animation: bounceUp 2s infinite;
}

@keyframes bounceUp {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .scroll-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }
}

[dir="rtl"] .scroll-to-top {
    right: auto;
    left: 2rem;
}

@media (max-width: 768px) {
    [dir="rtl"] .scroll-to-top {
        left: 1.5rem;
    }
}

@media (max-width: 480px) {
    [dir="rtl"] .scroll-to-top {
        left: 1rem;
    }
}