/* Mobile Navigation Styles */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: var(--accent-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.mobile-menu-btn .menu-icon {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    /* Скрываем обычную навигацию на мобильных */
    nav:not(.mobile-nav) {
        display: none !important;
    }
}

.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 998;
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--card-bg);
    z-index: 999;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--accent-color);
    color: white;
}

.mobile-nav-logo {
    width: 32px;
    height: 32px;
}

.mobile-nav-header span {
    font-weight: 700;
    font-size: 18px;
    flex: 1;
}

.close-menu {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-menu:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-content {
    padding: 20px;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    font-weight: 500;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    background: var(--accent-color);
    color: white;
    transform: translateX(5px);
}

.mobile-nav-link .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mobile-nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.login-link {
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid var(--accent-color);
}

.register-link {
    background: var(--accent-color);
    color: white !important;
}

.mobile-nav-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.theme-switcher-mobile {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.theme-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
}

.theme-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Mobile optimizations for specific pages */
@media (max-width: 768px) {

    /* Dashboard mobile */
    .dashboard-container {
        flex-direction: column;
        gap: 20px;
    }

    .dashboard-sidebar {
        width: 100%;
        order: 2;
    }

    .dashboard-content {
        order: 1;
    }

    /* Auth pages mobile */
    .auth-container {
        padding: 20px 0;
    }

    .auth-card {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    /* Admin pages mobile */
    .admin-stats {
        grid-template-columns: 1fr;
    }

    .table-wrapper {
        overflow-x: auto;
    }

    /* Forms mobile */
    .form-row {
        flex-direction: column;
    }

    .tile-selector {
        grid-template-columns: 1fr;
    }

    .class-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch feedback improvements */
@media (hover: none) and (pointer: coarse) {

    button,
    .btn-primary,
    .btn-secondary,
    a[role="button"],
    .nav-item,
    .tile-option,
    .class-btn {
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }

    /* Улучшенная обратная связь при касании */
    .mobile-nav-link:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Safe area support for notches */
@supports (padding: max(0px)) {
    .mobile-nav {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }

    .mobile-menu-btn {
        top: max(20px, env(safe-area-inset-top));
        right: max(20px, env(safe-area-inset-right));
    }
}

/* Стили для профиля пользователя */
.user-auth-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.user-profile-link:hover {
    color: var(--accent-color);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    background-size: cover;
    background-position: center;
}

.user-name {
    font-weight: 500;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

/* Фикс для съехавшего текста в карточках */
.card-label {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: block;
    margin-top: 8px;
    line-height: 1.2;
}

.visual-card {
    text-align: center;
    padding: 15px;
}

.visual-card svg {
    display: block;
    margin: 0 auto;
}

/* Стили для профиля пользователя */
.user-auth-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.user-profile-link:hover {
    color: var(--accent-color);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    background-size: cover;
    background-position: center;
}

.user-name {
    font-weight: 500;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

/*     */
.user-auth-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.user-profile-link:hover {
    color: var(--accent-color);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    background-size: cover;
    background-position: center;
}

.user-name {
    font-weight: 500;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

/*    */
@media (max-width: 768px) {
    .user-auth-info {
        flex-direction: column;
        gap: 10px;
    }

    .user-profile-link {
        justify-content: center;
    }

    .logout-btn {
        width: 100%;
        text-align: center;
    }
}

/* Mobile Navigation and Components */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: var(--accent-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.mobile-menu-btn .menu-icon {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
}

.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 998;
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--card-bg);
    z-index: 999;
    transition: right 0.3s ease;
    padding: 0;
    overflow-y: auto;
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--accent-color);
    color: white;
}

.mobile-nav-logo {
    width: 32px;
    height: 32px;
}

.mobile-nav-header span {
    font-weight: 700;
    font-size: 18px;
    flex: 1;
}

.close-menu {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-menu:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-content {
    padding: 20px;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    font-weight: 500;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    background: var(--accent-color);
    color: white;
    transform: translateX(5px);
}

.mobile-nav-link .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mobile-nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.login-link {
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid var(--accent-color);
}

.register-link {
    background: var(--accent-color);
    color: white !important;
}

/*     */
.user-auth-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.user-profile-link:hover {
    color: var(--accent-color);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    background-size: cover;
    background-position: center;
}

.user-name {
    font-weight: 500;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

/*    */
@media (max-width: 768px) {
    .user-auth-info {
        flex-direction: column;
        gap: 10px;
    }

    .user-profile-link {
        justify-content: center;
    }

    .logout-btn {
        width: 100%;
        text-align: center;
    }
}

/*    */
.mobile-auth-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    z-index: 1000;
    display: none;
}

@media (max-width: 768px) {
    .mobile-auth-panel {
        display: block;
    }
}

/*      */
.mobile-auth-buttons {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.mobile-login-btn,
.mobile-register-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.mobile-login-btn {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.mobile-register-btn {
    background: #000;
    color: #fff;
    border: 1px solid #000;
}

.mobile-login-btn:hover,
.mobile-register-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/*     */
.mobile-user-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mobile-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.mobile-user-avatar {
    width: 40px;
    height: 40px;
    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: 16px;
    background-size: cover;
    background-position: center;
}

.mobile-user-info {
    display: flex;
    flex-direction: column;
}

.mobile-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #000;
}

.mobile-user-status {
    font-size: 12px;
    color: #666;
}

.mobile-user-actions {
    display: flex;
    gap: 8px;
}

.mobile-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.logout-btn {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.logout-btn:hover {
    background: rgba(255, 59, 48, 0.2);
}

/* Dropdown    */
.user-profile-dropdown {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-profile-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    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: 14px;
    background-size: cover;
    background-position: center;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #000;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 8px 0;
}

.logout-item {
    color: #ff3b30;
}

.logout-item:hover {
    background: rgba(255, 59, 48, 0.1);
}

/*    */
.mobile-auth-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    z-index: 1000;
    display: none;
}

@media (max-width: 768px) {
    .mobile-auth-panel {
        display: block;
    }
}

/*      */
.mobile-auth-buttons {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.mobile-login-btn,
.mobile-register-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-family: inherit;
}

.mobile-login-btn {
    background: transparent;
    color: #000;
    border-color: rgba(0, 0, 0, 0.2);
}

.mobile-login-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.mobile-register-btn {
    background: #000;
    color: #fff;
    border-color: #000;
}

.mobile-register-btn:hover {
    background: #333;
    border-color: #333;
    transform: translateY(-1px);
}

/*     */
.mobile-user-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mobile-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.mobile-user-avatar {
    width: 40px;
    height: 40px;
    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: 16px;
    background-size: cover;
    background-position: center;
}

.mobile-user-info {
    display: flex;
    flex-direction: column;
}

.mobile-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #000;
}

.mobile-user-status {
    font-size: 12px;
    color: #666;
}

.mobile-user-actions {
    display: flex;
    gap: 8px;
}

.mobile-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.mobile-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.logout-btn {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.logout-btn:hover {
    background: rgba(255, 59, 48, 0.2);
}