/* 1. base.html */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 3px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.logo-section:hover {
    transform: scale(1.02);
}

.logo-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.logo-img:hover {
    transform: rotate(10deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.site-title {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
}

.site-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 2px;
    font-weight: 300;
}

/* Навигация */
.main-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    overflow: visible !important;
}

.nav-item-menu {
    position: relative;
    flex-shrink: 0;
}

.nav-link {
    color: rgb(255, 255, 255);
    text-decoration: none;
    padding: 12px 18px;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    min-height: 44px;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-link.active {
    background: rgba(102, 126, 234, 0.4);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.nav-link i,
.nav-link span {
    position: relative;
    color: rgb(255, 255, 255);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.nav-link:hover i {
    transform: scale(1.1);
}

.nav-link:hover span {
    transform: translateX(3px);
}

/* Выпадающее меню (десктоп) */
.nav-item-menu.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.dropdown-arrow {
    font-size: 0.7em;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 220px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 10000;
    list-style: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 5px;
    max-height: 0;
    overflow: hidden;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-item-menu.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 500px;
    overflow: visible;
}

.nav-item-menu.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-item {
    position: relative;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
}

.dropdown-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding-left: 25px;
}

.dropdown-link i {
    width: 16px;
    text-align: center;
    color: #667eea;
    font-size: 0.9em;
}

.dropdown-link.active {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    border-left: 3px solid #667eea;
}

/* Блок авторизации */
.auth-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 20px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}

.user-info::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%);
    transition: left 0.7s ease;
    z-index: -1;
}

.user-info:hover::after {
    left: 100%;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.user-name {
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    z-index: 2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    color: white;
    text-decoration: none;
}

.auth-links {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.auth-link {
    color: white;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
}

.auth-link::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%);
    transition: left 0.7s ease;
    z-index: -1;
}

.auth-link:hover::after {
    left: 100%;
}

.auth-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.auth-link.login {
    background: rgba(255, 255, 255, 0.1);
}

.auth-link.register {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    border: none;
}

/* Мобильная кнопка */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 5px;
    position: relative;
    z-index: 1001;
    flex-shrink: 0;
}

.mobile-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Основной контент */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 30px auto;
    padding: 0 20px;
}

.content-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 400px;
}

/* Футер */
.main-footer {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: white;
    padding: 40px 20px;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-logo-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.footer-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #e2e8f0;
}

.footer-info {
    flex: 1;
    max-width: 600px;
}

.footer-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #a0aec0;
    text-align: center;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-link {
    color: #cbd5e0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer-link:hover {
    color: #f7f7f7;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Уведомления */
.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e53e3e;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    animation: pulse 2s infinite;
    z-index: 3;
    white-space: nowrap;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(229, 62, 62, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0);
    }
}

/* ========== АДАПТИВНОСТЬ ========== */

/* Десктоп версия (только для экранов шире 1024px) */
@media (min-width: 1025px) {
    .mobile-toggle {
        display: none !important;
    }
    
    .nav-menu {
        display: flex !important;
        flex-direction: row;
        position: static;
        background: transparent;
        max-height: none;
        overflow: visible;
        box-shadow: none;
        padding: 0;
    }
    
    .dropdown-menu {
        position: absolute;
        background: white;
        opacity: 0;
        visibility: hidden;
    }
    
    .nav-item-menu.dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
    }
}

/* Планшеты и все мобильные устройства (1024px и меньше) */
@media (max-width: 1024px) {
    .header-content {
        flex-wrap: wrap;
        align-items: center;
        position: relative;
    }
    
    .logo-section {
        flex: 1;
        min-width: 0;
    }
    
    .site-title {
        font-size: 1.3rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .site-subtitle {
        font-size: 0.65rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .logo-img {
        width: 45px;
        height: 45px;
        flex-shrink: 0;
    }
    
    .mobile-toggle {
        display: block !important;
        margin-left: 10px;
        order: 2;
        flex-shrink: 0;
        z-index: 1002;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 10px 12px;
        border-radius: 8px;
    }
    
    .auth-section {
        display: none !important;
    }
    
    .main-nav {
        order: 4;
        width: 100%;
        position: static;
    }
    
    /* Скрываем обычное меню */
    .nav-menu {
        display: none !important;
    }
    
    .content-container {
        padding: 20px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .site-title {
        font-size: 1.1rem;
    }
    
    .site-subtitle {
        font-size: 0.55rem;
    }
    
    .logo-img {
        width: 40px;
        height: 40px;
    }
}

/* Стили для разделения аватарки и кнопки выхода */
.user-profile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.logout-button {
    width: 100%;
}

.auth-link.logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(220, 38, 38, 0.9);
    border: none;
    width: 100%;
    text-align: center;
}

.auth-link.logout:hover {
    background: rgba(220, 38, 38, 1);
    transform: translateY(-2px);
}

@media (max-width: 1024px) {
    .logo-text-wrapper.mobile-hidden {
        display: none;
    }
}

/* ========== МОБИЛЬНОЕ МОДАЛЬНОЕ МЕНЮ ========== */
@media (max-width: 1024px) {
    /* Модальное окно */
    .mobile-modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        z-index: 2000;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
        overflow-x: hidden;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .mobile-modal-overlay.active {
        transform: translateX(0);
    }
    
    /* Шапка модального окна */
    .mobile-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        background: rgba(0, 0, 0, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .mobile-modal-header h3 {
        color: white;
        margin: 0;
        font-size: 1.3rem;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .mobile-modal-header h3 i {
        font-size: 1.2rem;
    }
    
    .mobile-modal-close {
        background: none;
        border: none;
        color: white;
        font-size: 1.8rem;
        cursor: pointer;
        padding: 5px 10px;
        transition: transform 0.3s;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }
    
    .mobile-modal-close:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: rotate(90deg);
    }
    
    /* Список навигации */
    .mobile-nav-list {
        list-style: none;
        padding: 20px;
        margin: 0;
    }
    
    .mobile-nav-item {
        margin-bottom: 5px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-nav-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 0;
        color: white;
        text-decoration: none;
        font-size: 1.1rem;
        transition: all 0.3s;
        cursor: pointer;
    }
    
    .mobile-nav-link:hover {
        padding-left: 10px;
        background: rgba(255, 255, 255, 0.05);
    }
    
    .mobile-nav-link i {
        width: 24px;
        font-size: 1.1rem;
    }
    
    /* Подменю */
    .mobile-submenu {
        list-style: none;
        padding-left: 36px;
        margin: 0;
        display: none;
        background: rgba(0, 0, 0, 0.15);
        border-radius: 10px;
        margin-bottom: 8px;
    }
    
    .mobile-submenu.active {
        display: block;
    }
    
    .mobile-submenu-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 0;
        color: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        font-size: 0.95rem;
        transition: all 0.3s;
    }
    
    .mobile-submenu-link:hover {
        padding-left: 10px;
        color: white;
        background: rgba(255, 255, 255, 0.05);
    }
    
    .mobile-submenu-link i {
        width: 20px;
        font-size: 0.9rem;
    }
    
    /* Иконка раскрытия подменю */
    .mobile-toggle-icon {
        margin-left: auto;
        transition: transform 0.3s;
        font-size: 0.8rem;
    }
    
    .mobile-toggle-icon.rotated {
        transform: rotate(180deg);
    }
    
    /* Блок авторизации в модальном окне */
    .mobile-auth-section {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 2px solid rgba(255, 255, 255, 0.2);
    }
    
    .mobile-user-profile {
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .mobile-user-info {
        display: flex;
        align-items: center;
        gap: 12px;
        background: rgba(255, 255, 255, 0.15);
        padding: 12px 20px;
        border-radius: 30px;
        width: 100%;
        justify-content: center;
        text-decoration: none;
    }
    
    .mobile-user-avatar {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: bold;
        font-size: 1.2rem;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .mobile-user-name {
        color: white;
        text-decoration: none;
        font-size: 1rem;
        font-weight: 500;
    }
    
    .mobile-logout-btn,
    .mobile-login-btn,
    .mobile-register-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 20px;
        border-radius: 30px;
        text-decoration: none;
        font-size: 1rem;
        transition: all 0.3s;
        width: 100%;
    }
    
    .mobile-logout-btn {
        background: rgba(220, 38, 38, 0.9);
        color: white;
    }
    
    .mobile-logout-btn:hover {
        background: rgba(220, 38, 38, 1);
        transform: translateY(-2px);
    }
    
    .mobile-login-btn {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .mobile-register-btn {
        background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
        color: white;
    }
    
    .mobile-auth-links {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    body.modal-menu-open {
        overflow: hidden;
    }
    
    /* Прокрутка */
    .mobile-modal-overlay::-webkit-scrollbar {
        width: 4px;
    }
    
    .mobile-modal-overlay::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-modal-overlay::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.4);
        border-radius: 4px;
    }
}