/* Alpine.js: скрывать элементы до инициализации */
[x-cloak] { display: none !important; }

/* Предотвращение горизонтального скролла */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Ограничение ширины для всех контейнеров */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* Блюр для скрытых фотографий каналов */
.blurred-avatar {
    filter: blur(10px);
    -webkit-filter: blur(10px);
}

/* ===================== Theme Toggle ===================== */
.theme-toggle {
    display: inline-block;
    position: relative;
}

.theme-toggle-track {
    width: 56px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 14px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-toggle-thumb {
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 12px;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.theme-icon {
    position: absolute;
    font-size: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

.theme-icon-sun {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.theme-icon-moon {
    opacity: 0;
    transform: translateX(20px) scale(0.5);
}

.theme-toggle-checkbox:checked + .theme-toggle-track {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
}

.theme-toggle-checkbox:checked + .theme-toggle-track .theme-toggle-thumb {
    transform: translateX(28px);
}

.theme-toggle-checkbox:checked + .theme-toggle-track .theme-icon-sun {
    opacity: 0;
    transform: translateX(-20px) scale(0.5);
}

.theme-toggle-checkbox:checked + .theme-toggle-track .theme-icon-moon {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.theme-toggle:hover .theme-toggle-track {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.theme-toggle:hover .theme-toggle-thumb {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active .theme-toggle-track {
    transform: translateY(0);
}

.theme-toggle:active .theme-toggle-thumb {
    transform: scale(0.95);
}

.theme-toggle-checkbox:checked:active + .theme-toggle-track .theme-toggle-thumb {
    transform: translateX(28px) scale(0.95);
}

/* ===================== Accessibility ===================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===================== Hamburger Menu ===================== */
.hamburger {
    position: relative;
    width: 20px;
    height: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hamburger:hover {
    transform: scale(1.1);
}

.hamburger-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    transform-origin: center;
}

.hamburger-line:nth-child(1) { top: 3px; }
.hamburger-line:nth-child(2) { top: 9px; }
.hamburger-line:nth-child(3) { top: 15px; }

.hamburger.active .hamburger-line:nth-child(1) {
    top: 9px;
    transform: rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.active .hamburger-line:nth-child(3) {
    top: 9px;
    transform: rotate(-45deg);
}

.hamburger:not(.active):hover .hamburger-line:nth-child(1) {
    transform: translateY(-1px);
}

.hamburger:not(.active):hover .hamburger-line:nth-child(3) {
    transform: translateY(1px);
}

/* ===================== Mobile Dropdown ===================== */
.mobile-dropdown {
    animation: slideDown 0.3s ease-out;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.mobile-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid rgba(255, 255, 255, 0.95);
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.1));
}

[data-theme="dark"] .mobile-dropdown {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .mobile-dropdown::before {
    border-bottom-color: rgba(30, 30, 30, 0.95);
}

.mobile-menu-item {
    position: relative;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 2px 0;
}

.mobile-menu-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateX(4px);
}

.mobile-menu-item:hover .mobile-menu-link {
    color: white;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
}

.mobile-menu-item a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.2s ease;
    border-radius: 0 2px 2px 0;
}

.mobile-menu-item:hover a::before {
    transform: scaleY(1);
}

.mobile-menu-icon {
    margin-right: 12px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===================== Cookie Consent ===================== */
.cookie-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(12px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    animation: slideUpCookie 0.4s ease-out;
    max-width: 100vw;
    overflow: hidden;
}

[data-theme="dark"] .cookie-modal {
    background: rgba(30, 30, 30, 0.98);
    border-top-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.cookie-modal-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
}

@media (min-width: 640px) {
    .cookie-modal-content {
        padding: 24px 32px;
    }
}

.cookie-modal-buttons {
    gap: 8px;
    margin-top: 12px;
}

@media (min-width: 640px) {
    .cookie-modal-buttons {
        gap: 12px;
        margin-top: 16px;
    }
}

.cookie-accept-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    min-height: 44px;
}

.cookie-accept-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cookie-settings-btn {
    background: transparent;
    color: currentColor;
    border: 1px solid currentColor;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    min-height: 44px;
    opacity: 0.8;
}

.cookie-settings-btn:hover {
    opacity: 1;
    background: rgba(102, 126, 234, 0.1);
}

@keyframes slideUpCookie {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-modal.hiding {
    animation: slideDownCookie 0.3s ease-in;
}

@keyframes slideDownCookie {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

.cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.cookie-settings-modal.show {
    display: flex;
}

.cookie-settings-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease-out;
}

[data-theme="dark"] .cookie-settings-content {
    background: #1f2937;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.cookie-category {
    padding: 16px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .cookie-category {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.cookie-category:last-child {
    border-bottom: none;
}

.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 12px;
}

.cookie-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.cookie-toggle input:checked + .cookie-toggle-slider:before {
    transform: translateX(24px);
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
    background-color: #4ade80;
    cursor: not-allowed;
}
