html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

.mag-header {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(60px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(60px) saturate(200%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: 8px 0;
}

.mag-header::before {
    content: '' !important;
    position: absolute !important;
    top: 1px !important;
    left: 1px !important;
    right: 1px !important;
    height: 40% !important;
    border-radius: 0 0 12px 12px / 0 0 8px 8px !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%) !important;
    pointer-events: none !important;
    z-index: 6 !important;
    transition: background 0.5s ease;
}

.header-glare-container {
    position: absolute !important;
    inset: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    z-index: 5 !important;
}

.header-glare {
    position: absolute !important;
    inset: 0 !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    background: radial-gradient(circle 150px at var(--hx, 50%) var(--hy, 50%), rgba(255, 255, 255, 0.12) 0%, transparent 100%) !important;
    mix-blend-mode: overlay !important;
}

.mag-header:hover .header-glare {
    opacity: 1 !important;
}

body.dark-theme .mag-header {
    background: rgba(30, 30, 35, 0.35) !important;
    backdrop-filter: blur(60px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(60px) saturate(200%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .mag-header::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 100%) !important;
}

body.dark-theme .header-glare {
    background: radial-gradient(circle 150px at var(--hx, 50%) var(--hy, 50%), rgba(255, 215, 0, 0.06) 0%, transparent 100%) !important;
}

.mag-header.scrolled {
    padding: 4px 0 !important;
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(60px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(60px) saturate(200%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

body.dark-theme .mag-header.scrolled {
    background: rgba(30, 30, 35, 0.5) !important;
    backdrop-filter: blur(60px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(60px) saturate(200%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

.mag-header.scrolled .signature-logo {
    font-size: 1.4rem !important;
}

.mag-header.scrolled .header-top {
    gap: 10px !important;
}

.mag-header.scrolled .search-button,
.mag-header.scrolled .theme-toggle,
.mag-header.scrolled .notification-toggle,
.mag-header.scrolled .refresh-button {
    display: none !important;
}

.header-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 !important;
    flex-wrap: nowrap !important;
    gap: 15px !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
}

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

.logo-link {
    text-decoration: none !important;
    display: inline-block !important;
    transition: all 0.3s ease !important;
    position: relative !important;
}

.signature-logo {
    font-family: 'Great Vibes', 'Playfair Display', 'Segoe Script', 'Brush Script MT', cursive !important;
    font-size: 1.8rem !important;
    font-weight: 400 !important;
    color: #000000 !important;
    transition: all 0.3s ease !important;
    display: inline-block !important;
    font-style: italic !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
}

body.dark-theme .signature-logo {
    color: #ffffff !important;
    text-shadow: 0 2px 20px rgba(255, 255, 255, 0.06) !important;
}

.logo-link:hover .signature-logo {
    opacity: 0.8 !important;
    transform: scale(1.02) !important;
}

.header-right {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
}

.notification-toggle {
    background: transparent !important;
    border: none !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    position: relative !important;
    color: #000000 !important;
}

body.dark-theme .notification-toggle {
    color: #ffffff !important;
}

.notification-toggle:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #000000 !important;
    border-radius: 50% !important;
    transform: none !important;
}

body.dark-theme .notification-toggle:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    transform: none !important;
}

.notification-toggle i {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

.notification-dot {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    width: 8px !important;
    height: 8px !important;
    background: #ff3b30 !important;
    border-radius: 50% !important;
    border: 2px solid transparent !important;
    transition: all 0.3s ease !important;
    opacity: 0 !important;
    transform: scale(0.5) !important;
}

body.dark-theme .notification-dot {
    border-color: rgba(0, 0, 0, 0.3) !important;
}

.notification-dot.show {
    opacity: 1 !important;
    transform: scale(1) !important;
    animation: blink-dot 1.5s ease-in-out infinite !important;
}

@keyframes blink-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(0.7);
    }
}

.search-button {
    background: transparent !important;
    border: none !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: #000000 !important;
}

body.dark-theme .search-button {
    color: #ffffff !important;
}

.search-button:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #000000 !important;
    border-radius: 50% !important;
    transform: none !important;
}

body.dark-theme .search-button:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    transform: none !important;
}

.search-button i {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

.refresh-button {
    background: transparent !important;
    border: none !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: #000000 !important;
    position: relative;
}

body.dark-theme .refresh-button {
    color: #ffffff !important;
}

.refresh-button:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #000000 !important;
    border-radius: 50% !important;
    transform: none !important;
}

body.dark-theme .refresh-button:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    transform: none !important;
}

.refresh-button i {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

.theme-toggle {
    background: transparent !important;
    border: none !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: #000000 !important;
}

body.dark-theme .theme-toggle {
    color: #ffffff !important;
}

.theme-toggle:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #000000 !important;
    border-radius: 50% !important;
    transform: none !important;
}

body.dark-theme .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    transform: none !important;
}

.toggle-icon {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

.theme-toggle.animate .toggle-icon {
    animation: iconSpinFull 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@keyframes iconSpinFull {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.refresh-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.refresh-modal.open {
    opacity: 1;
    display: flex !important;
}

body.dark-theme .refresh-modal {
    background: rgba(0, 0, 0, 0.6);
}

.refresh-modal-content {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(50px) saturate(200%);
    -webkit-backdrop-filter: blur(50px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    max-width: 420px;
    width: 100%;
    padding: 32px 28px;
    box-shadow: 
        0 40px 80px -20px rgba(0, 0, 0, 0.08),
        0 10px 30px -10px rgba(0, 0, 0, 0.04),
        inset 0 2px 3px -1px rgba(255, 255, 255, 0.8),
        inset 0 -2px 4px -1px rgba(255, 255, 255, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    position: relative;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
    max-height: 85vh;
    overflow-y: auto;
}

.refresh-modal.open .refresh-modal-content {
    transform: scale(1) translateY(0);
}

body.dark-theme .refresh-modal-content {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(50px) saturate(200%);
    -webkit-backdrop-filter: blur(50px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 40px 80px -20px rgba(0, 0, 0, 0.5),
        0 10px 30px -10px rgba(0, 0, 0, 0.3),
        inset 0 2px 3px -1px rgba(255, 255, 255, 0.08),
        inset 0 -2px 4px -1px rgba(255, 255, 255, 0.03),
        inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.refresh-modal-content::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    height: 46%;
    border-radius: 20px 20px 12px 12px / 20px 20px 8px 8px;
    background: transparent;
    pointer-events: none;
    z-index: 6;
    transition: background 0.5s ease;
}

body.dark-theme .refresh-modal-content::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 100%);
}

.refresh-modal-content .modal-glare-container {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

.refresh-modal-content .modal-glare {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(circle 120px at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.15) 0%, transparent 100%);
    mix-blend-mode: overlay;
}

body.dark-theme .refresh-modal-content .modal-glare {
    background: radial-gradient(circle 120px at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.06) 0%, transparent 100%);
}

.refresh-modal-content:hover .modal-glare {
    opacity: 1;
}

.refresh-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent !important;
    border: none !important;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0, 0, 0, 0.25);
    z-index: 2;
    padding: 0;
    transition: all 0.3s ease;
}

body.dark-theme .refresh-modal-close {
    color: rgba(255, 255, 255, 0.25);
}

.refresh-modal-close:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #000000 !important;
}

body.dark-theme .refresh-modal-close:hover {
    background: rgba(255, 215, 0, 0.08) !important;
    color: #ffd700 !important;
}

.refresh-modal-close i {
    width: 20px;
    height: 20px;
}

.refresh-modal-content-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.refresh-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 122, 255, 0.08);
    color: #007aff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 12px auto;
}

body.dark-theme .refresh-modal-icon {
    background: rgba(255, 215, 0, 0.08);
    color: #ffd700;
}

.refresh-modal-icon i {
    width: 28px;
    height: 28px;
}

.refresh-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1a1a1a;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .refresh-modal-title {
    color: #e0e0e0;
}

.refresh-modal-desc {
    font-size: 0.9rem;
    line-height: 1.8;
    color: #444;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    margin: 0 0 24px 0;
    text-align: center;
}

body.dark-theme .refresh-modal-desc {
    color: #b0b8c8;
}

.refresh-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 32px;
    background: #007aff !important;
    border: 1px solid #007aff !important;
    color: white !important;
    border-radius: 30px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.refresh-modal-btn:hover {
    background: #007aff !important;
    border-color: #007aff !important;
    transform: scale(1.02);
    box-shadow: 0 6px 25px rgba(0, 122, 255, 0.4);
}

.refresh-modal-btn:active {
    transform: scale(0.95);
}

body.dark-theme .refresh-modal-btn {
    background: #ffd700 !important;
    border-color: #ffd700 !important;
    color: #0a1628 !important;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

body.dark-theme .refresh-modal-btn:hover {
    background: #ffd700 !important;
    border-color: #ffd700 !important;
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.4);
}

.refresh-modal-btn i {
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    .mag-header {
        padding: 6px 0 !important;
    }
    .signature-logo {
        font-size: 1.4rem !important;
    }
    .search-button,
    .theme-toggle,
    .notification-toggle,
    .refresh-button {
        width: 34px !important;
        height: 34px !important;
    }
    .search-button i,
    .toggle-icon,
    .notification-toggle i,
    .refresh-button i {
        width: 18px !important;
        height: 18px !important;
    }
    .mag-header.scrolled .signature-logo {
        font-size: 1.1rem !important;
    }
    .refresh-modal-content {
        max-width: 95%;
        padding: 24px 20px;
        border-radius: 18px;
    }
    .refresh-modal-title {
        font-size: 1.1rem;
    }
    .refresh-modal-desc {
        font-size: 0.85rem;
    }
    .refresh-modal-btn {
        font-size: 0.8rem;
        padding: 8px 24px;
    }
    .refresh-modal-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    .refresh-modal-icon i {
        width: 24px;
        height: 24px;
    }
    .refresh-modal-close {
        top: 14px;
        right: 14px;
        width: 32px;
        height: 32px;
    }
    .refresh-modal-close i {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .mag-header {
        padding: 4px 0 !important;
    }
    .signature-logo {
        font-size: 1.1rem !important;
    }
    .search-button,
    .theme-toggle,
    .notification-toggle,
    .refresh-button {
        width: 30px !important;
        height: 30px !important;
    }
    .search-button i,
    .toggle-icon,
    .notification-toggle i,
    .refresh-button i {
        width: 16px !important;
        height: 16px !important;
    }
    .header-top {
        gap: 8px !important;
    }
    .mag-header.scrolled .signature-logo {
        font-size: 0.9rem !important;
    }
    .refresh-modal-content {
        max-width: 98%;
        padding: 20px 16px;
        border-radius: 16px;
    }
    .refresh-modal-title {
        font-size: 1rem;
    }
    .refresh-modal-desc {
        font-size: 0.8rem;
        margin-bottom: 20px;
    }
    .refresh-modal-btn {
        font-size: 0.75rem;
        padding: 6px 20px;
    }
    .refresh-modal-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
    .refresh-modal-icon i {
        width: 22px;
        height: 22px;
    }
    .refresh-modal-close {
        top: 12px;
        right: 12px;
        width: 28px;
        height: 28px;
    }
    .refresh-modal-close i {
        width: 16px;
        height: 16px;
    }
}