/* style.css - Modern Redesign */
/* === CSS Variables for Modern Design === */
:root[data-theme="light"] {
    --primary: #ff7e5f;
    --primary-gradient: #feb47b;
    --secondary: #6a89cc;
    --accent: #4ecdc4;
    --success: #1dd1a1;
    --warning: #feca57;
    --error: #ff6b6b;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-overlay: rgba(255, 255, 255, 0.8);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-gradient));
    --gradient-card: linear-gradient(135deg, #ffffff, #f8fafc);
}

:root[data-theme="dark"] {
    --primary: #818cf8;
    --primary-gradient: #a78bfa;
    --secondary: #fb7185;
    --accent: #34d399;
    --success: #10b981;
    --warning: #fbbf24;
    --error: #f87171;
    --error: #f87171;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --bg-overlay: rgba(15, 23, 42, 0.8);
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --border-light: #334155;
    --border-medium: #475569;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-gradient));
    --gradient-card: linear-gradient(135deg, #1e293b, #0f172a);
}

:root {
    --offline-banner-height: 0px;
}

.hidden 
{
	opacity: 0 !important;
    pointer-events: none !important;
}

/* Смещение кнопок, когда баннер офлайна виден */
body.offline-banner-visible .notification-bell-container,
body.offline-banner-visible .menu-toggle-modern {
    top: calc(1rem + var(--offline-banner-height)) !important;
}

/* Мобильная правка */
@media (max-width: 768px) {
    body.offline-banner-visible .notification-bell-container,
    body.offline-banner-visible .menu-toggle-modern {
        top: calc(0.5rem + var(--offline-banner-height)) !important;
    }
}


/* === Modern Base Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    font-weight: 400;
    transition: all 0.3s ease;
}

/* === Modern Typography === */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h4 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

/* === Modern Container & Layout === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* === Modern Cards === */
.modern-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

/* === Modern Buttons === */
.btn-modern {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-modern:active {
    transform: translateY(0);
}

.btn-modern-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.btn-modern-secondary:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

/* === Modern Form Elements === */
.form-modern {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.form-control-modern {
    background: var(--bg-primary);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 126, 95, 0.1);
    transform: translateY(-1px);
}

.form-control-modern::placeholder {
    color: var(--text-muted);
}

/* === Modern Navigation & Tabs === */
.nav-modern {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 0.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.nav-item-modern {
    flex: 1;
    text-align: center;
}

.nav-link-modern {
    display: block;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-link-modern:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link-modern.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

/* === Exercise Cards - Modern Design === */
.exercise-card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.exercise-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.exercise-card-modern:hover::before {
    width: 6px;
}

.exercise-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.exercise-difficulty {
    padding: 0.5rem 0.5rem;
    border-radius: 20px;
    color: var(--warning-color, #f59e0b);
    font-weight: 600;
    box-shadow: 0px 0px 3px 3px rgba(0, 0, 0, 0.05);
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.exercise-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.exercise-stats {
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.exercise-recommendation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-light);
    margin-top: 0.75rem;
}

.exercise-actions {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    opacity: 1;
    transition: all 0.3s ease;
    display: flex;
    gap: 0.5rem;
}

.exercise-card-modern .action-delete,
.exercise-card-modern .action-edit,
.exercise-card-modern .action-btn {
    opacity: 0;
}

.exercise-card-modern:hover .action-delete,
.exercise-card-modern:hover .action-edit,
.exercise-card-modern:hover .action-btn {
    opacity: 1;
}

.exercise-note-container {
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px dashed rgba(148, 163, 184, 0.6);
}

[data-theme="dark"] .exercise-note-container {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(148, 163, 184, 0.8);
}

.exercise-note-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.exercise-note-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
}


.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
}

.action-edit {
    background: var(--success);
}

.action-delete {
    background: var(--error);
}

.action-btn:hover {
    transform: scale(1.1);
}

/* === Modern Tabs Container === */
.tabs-container-modern {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: thin;
	scrollbar-color: var(--primary);
}

.tab-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-modern:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.tab-modern.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.tab-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.tab-actions .edit-btn,
.tab-actions .delete-btn,
.tab-actions .archive-btn {
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    font-size: 0.9rem;
}

.tab-modern:hover .tab-actions .edit-btn,
.tab-modern:hover .tab-actions .delete-btn,
.tab-modern:hover .tab-actions .archive-btn {
    opacity: 1;
}

/* === Modern Table === */
.table-modern {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: 2rem 0;
}

.table-modern thead {
    background: var(--gradient-primary);
    color: white;
}

.table-modern th {
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table-modern td {
    border-color: var(--border-light);
    padding: 1rem 1.5rem;
    vertical-align: middle;
}

.table-modern tbody tr {
    transition: all 0.3s ease;
}

.table-modern tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
}

/* === Auth Pages === */
.min-vh-80 {
    min-height: 80vh;
}

.app-logo {
    animation: float 3s ease-in-out infinite;
}

.feature-item {
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.alert-modern {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.alert-success {
    background: var(--gradient-primary);
    color: white;
}

/* === Dashboard Improvements === */
.hat {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.login-info {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--border-light);
}

/* === Form Groups === */
.form-group-modern {
    margin-bottom: 1.5rem;
}

.form-label-modern {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: block;
}

/* === Input Groups === */
.input-group-modern {
    position: relative;
}

.input-group-modern .input-group-text {
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-right: none;
    color: var(--text-muted);
}

.input-group-modern .form-control {
    border-left: none;
    padding-left: 0;
}

/* === Comparison Cards === */
.comparison-card-modern {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.photo-grid-modern {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.photo-item-modern {
    text-align: center;
}

.photo-item-modern img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--border-light);
}

/* Контейнер пары фото */
.modal-photo-compare {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* всегда 2 колонки */
    gap: 2rem;
    justify-content: center;
    align-items: start;
    padding: 1rem;
}

/* Карточка с одним фото */
.modal-photo-item {
    background: var(--bg-secondary, #f8f9fa);
    padding: 0.75rem;
    border: 1px solid var(--border-light, #ddd);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    max-width: 100%;
    box-sizing: border-box;
}

/* Фото адаптивное */
.modal-photo-item img {
    width: 100%;
    height: auto;
    max-width: 450px; /* ограничение для больших экранов */
    border-radius: 8px;
}

/* Подпись под фото */
.modal-photo-item small {
    margin-top: 0.5rem;
    color: #666;
}

/* Информация под парой фото */
.measure-info-modern {
    margin-top: 1rem;
    background: var(--bg-secondary, #fafafa);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-light, #ddd);
    font-size: 0.95rem;
    line-height: 1.4;
}


/* === Badge Modern === */
.badge-modern {
    background: var(--gradient-primary);
    color: white;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
}

/* === Progress Bars === */
.progress-modern {
    background: var(--bg-secondary);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.progress-bar-modern {
    background: var(--gradient-primary);
    height: 100%;
    transition: width 0.3s ease;
}

/* === Stats Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-gradient);
}

/* === Utility Classes === */
.glass-effect {
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(255, 126, 95, 0.15);
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .modern-card {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .tabs-container-modern {
        margin: 1rem 0;
        padding: 0.5rem;
    }
    
    .tab-modern {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .photo-grid-modern {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .exercise-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .exercise-stats {
        align-self: flex-start;
    }
	
	.modal-photo-compare {
        grid-template-columns: repeat(2, 1fr); /* фиксируем 2 колонки */
        gap: 1rem;
    }

    .modal-photo-item img {
        max-width: 100%;
    }

    .measure-info-modern {
        font-size: 0.9rem;
        padding: 0.8rem 1rem;
    }
	
	#tableFullscreenModal .modal-body-modern table th,
    #tableFullscreenModal .modal-body-modern table td {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
    }
}

/* === Loading States === */
.skeleton-loader {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dropdown Modern */
.dropdown-menu-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}

.dropdown-menu-modern .dropdown-item {
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 0.25rem 0;
    transition: all 0.3s ease;
}

.dropdown-menu-modern .dropdown-item:hover,
.dropdown-menu-modern .dropdown-item.active {
    background: var(--gradient-primary);
    color: white;
}

/* List Group Modern */
.list-group-item-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.list-group-item-modern:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

/* История результатов упражнения: редактирование */
.history-item {
    position: relative;
}

.history-item-actions {
    display: inline-flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-item:hover .history-item-actions {
    opacity: 1;
}

/* Подсветка редактируемой строки */
.history-item-editing {
    border: 2px dashed var(--primary);
    background: var(--bg-hover);
}

/* Sidebar Modern */
.sidebar-nav-modern .nav-link {
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin: 0.25rem 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: none;
    background: transparent;
    width: calc(100% - 2rem);
    cursor: pointer;
}

.sidebar-nav-modern .nav-link:hover,
.sidebar-nav-modern .nav-link.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateX(8px);
}

/* Menu Toggle */
.menu-toggle-modern {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1200;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    cursor: pointer;
}

.menu-toggle-modern:hover {
    transform: scale(1.1);
}

.menu-toggle-modern.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

/* Backdrop */
.backdrop-modern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1090;
    display: none;
}

/* Form Range Modern */
.form-range {
    width: 100%;
    height: 1.5rem;
    padding: 0;
    background-color: transparent;
    appearance: none;
}

.form-range:focus {
    outline: none;
}

.form-range::-webkit-slider-track {
    background: var(--border-light);
    border-radius: 1rem;
    height: 0.5rem;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    height: 1.5rem;
    width: 1.5rem;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    margin-top: -0.5rem;
}

.form-range::-moz-range-track {
    background: var(--border-light);
    border-radius: 1rem;
    height: 0.5rem;
    border: none;
}

.form-range::-moz-range-thumb {
    height: 1.5rem;
    width: 1.5rem;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    border: none;
}

/* Модальные окна - исправления */
.modal-modern {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    z-index: 1050;
    overflow-y: auto;
    padding: 1rem;
}

.modal-content-modern {
    background: var(--bg-card);
    border: none;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    margin: auto;
    max-width: 95%;
	font-size: 0.875rem; /* ~14px */
    line-height: 1.4;
}

.modal-header-modern {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1.5rem 2rem;
    position: relative;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.modal-header-modern .btn-close {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    filter: invert(1);
}

.modal-body-modern {
    padding: 2rem;
    background: var(--bg-card);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.modal-footer-modern {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: 1.5rem 2rem;
    border-radius: 0 0 20px 20px;
}

/* Боковое меню - исправления */
.sidebar-modern {
    background: var(--bg-card);
    border-right: 1px solid var(--border-light);
    height: 100vh;
    position: fixed;
    left: -340px;
    top: 0;
    width: 340px;
    transition: left 0.3s ease;
    z-index: 1100;
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-modern.open {
    left: 0;
}

.sidebar-header-modern {
    background: var(--gradient-primary);
    padding: 2rem;
    text-align: center;
    color: white;
    flex-shrink: 0;
    position: relative;
}

/* === ИСПРАВЛЕННЫЕ СТИЛИ ЛОГОТИПА === */

/* Логотип для светлой темы - оранжевый */
:root[data-theme="light"] .sidebar-header-modern h1 span {
    background: linear-gradient(135deg, #ffffff, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    display: block;
    font-size: 2.5rem;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

/* Логотип для темной темы - фиолетовый */
:root[data-theme="dark"] .sidebar-header-modern h1 span {
    background: linear-gradient(135deg, #ffffff, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    display: block;
    font-size: 2.5rem;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

/* Стили для подзаголовка "Ваш фитнес-компаньон" */
.sidebar-header-modern p {
    color: white !important;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.3px;
    margin-top: 0.75rem;
    opacity: 0.95;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.sidebar-nav-modern {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-modern .border-top {
    border-top: 1px solid var(--border-light) !important;
    flex-shrink: 0;
}

/* Запрет прокрутки body при открытом модальном окне */
body.modal-open {
    overflow: hidden;
}

/* Анимация появления модальных окон */
.modal-content-modern {
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* === Исправления для темной темы === */

/* Текст в темной теме */
:root[data-theme="dark"] .text-muted {
    color: #cbd5e1 !important;
    opacity: 0.8;
}

/* Таблицы в темной теме */
:root[data-theme="dark"] .table-modern {
    background: var(--bg-card);
    color: var(--text-primary);
}

:root[data-theme="dark"] .table-modern th {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

:root[data-theme="dark"] .table-modern td {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-light);
}

:root[data-theme="dark"] .table-modern tbody tr:hover {
    background: var(--bg-hover);
}

/* Карточки с фото в замерах */
.photo-grid-modern {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.photo-item-modern {
    text-align: center;
}

.photo-item-modern img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    border-radius: 12px;
    border: 2px solid var(--border-light);
    background: var(--bg-secondary);
}

.measure-info-modern {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    text-align: center;
}

.measure-info-modern p {
    margin: 0.5rem 0;
    text-align: center;
}

.measure-info-modern strong {
    color: var(--text-primary);
}

/* Модальные окна - исправления кликабельности */
.modal-modern {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1050;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.modal-dialog {
    margin: 0 auto;
    max-width: 600px;
    pointer-events: none;
}

.modal-content-modern {
    background: var(--bg-card);
    border: none;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    pointer-events: auto;
}

.modal-header-modern {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1.5rem 2rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-modern .btn-close {
    position: static;
    transform: none;
    filter: invert(1);
    margin-left: auto;
}

.modal-body-modern {
    padding: 2rem;
    background: var(--bg-card);
    max-height: calc(80vh - 200px);
    overflow-y: auto;
}

.modal-footer-modern {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: 1.5rem 2rem;
    border-radius: 0 0 20px 20px;
}

/* Контейнер для фото в замерах */
#measurements-photos-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.comparison-card-modern {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .modal-modern {
        padding: 1rem 0.5rem;
    }
    
    .modal-dialog {
        max-width: 95%;
    }
    
    .photo-grid-modern {
        grid-template-columns: 1fr;
    }
    
    .photo-item-modern img {
        height: 250px;
    }
    
    .sidebar-header-modern h1 span {
        font-size: 2rem;
    }
    
    .sidebar-header-modern p {
        font-size: 0.9rem;
    }
}

/* Стили для таблицы с нормами */
.table-success {
    background-color: rgba(34, 197, 94, 0.1) !important;
    border-left: 3px solid #22c55e;
}

.table-danger {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border-left: 3px solid #ef4444;
}

/* Стили для значений шагов с подсказкой */
.steps-value {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #666;
}

.steps-value:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .steps-value:hover::after {
        display: none;
    }
    
    .steps-value::before {
        content: "≈ " attr(data-calories) " ккал";
        display: block;
        font-size: 0.8rem;
        color: #666;
        margin-top: 2px;
    }
}

/* Анимация пульсации для прогресс-бара */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Стили для таблицы с нормами */
.table-success {
    background-color: rgba(34, 197, 94, 0.1) !important;
    border-left: 3px solid #22c55e;
}

.table-danger {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border-left: 3px solid #ef4444;
}

/* Стили для значений шагов с калориями */
.steps-cell {
    min-width: 80px;
}

/* Для десктопов - подсказка при наведении */
.steps-value-desktop {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #666;
}

.steps-value-desktop:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
}

/* Для мобильных - калории сразу под шагами */
.steps-value-mobile {
    text-align: center;
    line-height: 1.2;
}

.steps-value-mobile small {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .steps-value-desktop {
        display: none;
    }
    
    .steps-value-mobile {
        display: block;
    }
    
    .table-modern th,
    .table-modern td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .steps-cell {
        min-width: 60px;
    }
}

@media (min-width: 769px) {
    .steps-value-mobile {
        display: none;
    }
    
    .steps-value-desktop {
        display: inline;
    }
}

/* Анимация пульсации для прогресс-бара */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Увеличение высоты модальных окон */
.modal-dialog.modal-lg {
    max-width: 95%;
    max-height: 90vh;
}

.modal-body-modern {
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

/* Специфично для модального окна экспорта */
#exportModal .modal-dialog {
    max-width: 98%;
    max-height: 95vh;
}

#exportModal .modal-body-modern {
    max-height: calc(95vh - 150px);
}

/* Увеличение высоты canvas для графика */
#exportChart {
    height: 500px !important;
    min-height: 500px;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .modal-dialog.modal-lg {
        max-width: 98%;
        max-height: 85vh;
    }
    
    .modal-body-modern {
        max-height: calc(85vh - 180px);
    }
    
    #exportModal .modal-dialog {
        max-width: 99%;
        max-height: 90vh;
    }
    
    #exportModal .modal-body-modern {
        max-height: calc(90vh - 140px);
    }
    
    #exportChart {
        height: 400px !important;
        min-height: 400px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 576px) {
    #exportChart {
        height: 350px !important;
        min-height: 350px;
    }
    
    .modal-body-modern {
        padding: 1rem;
    }
}

/* === СИСТЕМА УВЕДОМЛЕНИЙ === */

/* Система уведомлений */
.notification-system {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 350px;
}

.notification {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
    max-width: 350px;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--error);
}

.notification-icon {
    font-size: 1.25rem;
}

.notification.success .notification-icon {
    color: var(--success);
}

.notification.error .notification-icon {
    color: var(--error);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

/* Колокольчик уведомлений */
.notification-bell-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1200;
}

.notification-bell {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.notification-bell:hover {
    transform: scale(1.1);
}

.notification-bell.hidden {
    opacity: 0 !important;
    transform: translateY(-20px);
    pointer-events: none;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Список уведомлений */
.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: rgba(129, 140, 248, 0.1);
}

.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.notification-item-title {
    font-weight: 600;
    color: var(--text-primary);
}

.notification-item-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.notification-item-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Архив, Переименование, Удаление */
.archive-btn, 
.edit-btn, 
.delete-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.archive-btn:hover,
.edit-btn:hover,
.delete-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Список архива */
.archive-list {
    max-height: 400px;
    overflow-y: auto;
}

.archive-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.archive-item:last-child {
    border-bottom: none;
}

.archive-item:hover {
    background: var(--bg-hover);
}

.archive-item-name {
    font-weight: 600;
    color: var(--text-primary);
}

.archive-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Исправление скролла для мобильных */
.sidebar-modern {
    height: 100vh;
    overflow-y: auto;
}

.sidebar-modern .mt-auto {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding: 1rem;
    border-top: 1px solid var(--border-light);
}

/* === ИСПРАВЛЕНИЯ Z-INDEX И ПОЗИЦИОНИРОВАНИЯ === */

/* Кнопка меню и колокольчик - самый верхний уровень */
.menu-toggle-modern,
.notification-bell-container {
    z-index: 1200 !important;
}

/* Боковое меню - под кнопками */
.sidebar-modern {
    z-index: 1100 !important;
}

/* Модальное окно уведомлений - между кнопками и меню */
#notificationsModal {
    z-index: 1150 !important;
}

/* Backdrop для бокового меню - под меню */
.backdrop-modern {
    z-index: 1090 !important;
}

/* Основные модальные окна */
.modal-modern {
    z-index: 1050 !important;
}

/* Выпадающие меню */
.dropdown-menu-modern {
    z-index: 1080 !important;
}

/* Убедимся, что все модальные окна правильно позиционированы */
.modal-dialog {
    z-index: 1055 !important;
}

.modal-content-modern {
    z-index: 1060 !important;
}

/* Анимации для кнопок */
.menu-toggle-modern,
.notification-bell-container {
    transition: all 0.3s ease !important;
}

/* Скрытие кнопки меню при скролле */
.menu-toggle-modern.hidden {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
    pointer-events: none !important;
}

/* При открытом меню - скрываем обе кнопки */
.sidebar-modern.open ~ .menu-toggle-modern,
.sidebar-modern.open ~ .notification-bell-container {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
}

/* Для мобильных устройств - адаптация */
@media (max-width: 768px) {
    .notification-bell-container {
        top: 0.5rem !important;
        right: 0.5rem !important;
    }
    
    .menu-toggle-modern {
        top: 0.5rem !important;
        left: 0.5rem !important;
    }
}

/* === Fix dropdown stacking and visibility === */
.dropdown-menu,
.dropdown-menu.show,
.dropdown-menu-modern {
    position: absolute !important;
    z-index: 2000 !important;
}

/* === Universal table expand button === */
.table-expand-wrapper { position: relative; }
.table-expand-btn {
	z-index: 10;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    border: none;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 4px 8px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.table-expand-btn:hover { background: var(--bg-hover); }

/* Fullscreen table modal */
#tableExpandModal.modal-modern { display: none; }
#tableExpandModal .modal-content-modern {
    width: 100%;
    max-width: 100%;
    height: 90vh;
}
#tableExpandModal .modal-body-modern {
    max-height: calc(90vh - 140px);
    overflow-y: auto;
    overflow-x: hidden; /* no horizontal scroll */
}
#tableExpandContent {
    width: 100%;
    max-width: 100%;
}
#tableExpandContent table { width: 100% !important; }

/* === PATCH v2: Fullscreen modal stronger precedence === */
#tableExpandModal .modal-content-modern{display:flex;flex-direction:column;height:100vh;max-height:100vh}
#tableExpandModal .modal-header-modern,#tableExpandModal .modal-footer-modern{flex:0 0 auto}
#tableExpandModal .modal-body-modern{flex:1 1 auto;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;padding:1rem}
#tableExpandContent{width:100%;max-width:100%}
#tableExpandContent table{width:100%!important;table-layout:fixed;border-collapse:collapse}
#tableExpandContent th,#tableExpandContent td{white-space:normal;word-break:break-word;overflow-wrap:anywhere;padding:0.5rem 0.75rem}
@media (max-width:480px){#tableExpandContent table{font-size:0.95rem}}

/* === PATCH v2b: allow modal root scroll as fallback === */
#tableExpandModal{overflow-y:auto}


/* === Fullscreen Table Modal (fixes for scrolling and stacking) === */
#tableFullscreenModal.modal-modern {
    display: none;
    z-index: 1200;
}

#tableFullscreenModal .modal-dialog {
    margin: 0;
    max-width: 100%;
    width: 100%;
    height: 100%;
}

#tableFullscreenModal .modal-content-modern {
    height: 100%;
    border-radius: 0;
}

#tableFullscreenModal .modal-header-modern {
    position: sticky;
    top: 0;
    z-index: 2;
}

#tableFullscreenModal .modal-body-modern {
    height: calc(100% - 140px);
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

#tableFullscreenModal .modal-body-modern table th,
#tableFullscreenModal .modal-body-modern table td {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.table-fullscreen-wrapper {
    width: 100%;
    overflow-x: hidden;
}

.table-fullscreen-wrapper table {
    width: 100% !important;
    table-layout: fixed;
    border-collapse: collapse;
}

.table-fullscreen-wrapper th,
.table-fullscreen-wrapper td {
    white-space: normal;
    word-break: break-word;
}

/* Ensure dropdowns render above tabs and content */
.dropdown-menu-modern,
.dropdown-menu {
    z-index: 2000;
}

/* Universal table container and expand button */
.table-container {
    position: relative;
}

.table-expand-btn {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 3;
}


/* === Fullscreen table tweaks === */
#tableExpandModal .modal-content-modern { height: 92vh; }
#tableExpandModal .modal-body-modern {
    max-height: calc(92vh - 140px);
    overflow-y: auto;
    overflow-x: hidden;
}
#tableExpandContent, #tableExpandContent .table-responsive { width: 100%; max-width: 100%; }
#tableExpandContent table {
    width: 100% !important;
    table-layout: fixed;
    border-collapse: collapse;
}
#tableExpandContent th, #tableExpandContent td {
    white-space: normal;
    word-break: break-word;
    padding: 0.5rem; /* чуть компактнее, чтобы влезало */
    vertical-align: top;
	font-size: 0.75rem; /* ~12px */
}

/* Для мобильных устройств - адаптация
@media (max-width: 768px) {
	#tableExpandContent th,
    #tableExpandContent td {
        font-size: 0.5rem;
        padding: 0.2rem 0.25rem;
    }
} */

/* Pin expand button to card header area (not scrolling with table) */
.card-header-actions { position: relative; }
.card-header-actions .table-expand-btn {
    position: static;
    margin-left: auto;
}
/* Position an absolute version if we still add inside wrapper somewhere */
.table-expand-wrapper { position: relative; }
.table-expand-wrapper .table-expand-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* === OFFLINE STATUS & UNSYNCED QUEUE === */

.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1300;
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(90deg, #ef4444, #f97316);
    color: #fff;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

.offline-banner i {
    font-size: 1.1rem;
}

/* Панель несинхронизированных операций снизу экрана */
.unsynced-panel {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0.75rem;
    width: min(480px, 90vw);
    z-index: 1290;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.unsynced-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    background: var(--bg-secondary);
}

.unsynced-summary span {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.unsynced-details {
    display: none;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}

.unsynced-details.open {
    display: block;
}

.unsynced-details ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.unsynced-details li {
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-light);
}

.unsynced-details li:last-child {
    border-bottom: none;
}

.unsynced-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.unsynced-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .offline-banner {
        font-size: 0.8rem;
    }

    .unsynced-panel {
        width: 96vw;
        bottom: 0.5rem;
    }
}

.sw-update-banner {
    position: fixed;
    left: 50%;
    bottom: 0.75rem;
    transform: translateX(-50%);
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: space-between;
    max-width: 480px;
    width: calc(100% - 2rem);
    padding: 0.75rem 1rem;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
    background: var(--card-bg, #111827);
    color: var(--text-color, #f9fafb);
    gap: 0.5rem;
    animation: swUpdateSlideUp 0.25s ease-out;
}

@keyframes swUpdateSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 100%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.sw-update-banner .sw-update-text {
    font-size: 0.9rem;
}

.sw-update-banner button {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .sw-update-banner button {
		margin: auto;
		text-align: center;
		white-space: nowrap;
	}
}

/* === Profile settings modal === */
.profile-settings-section {
    background: var(--bg-secondary);
    border-radius: 18px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.25rem;
}

.profile-settings-section:last-child {
    margin-bottom: 0;
}
/* Аватар в модалке профиля */
.profile-avatar-wrapper {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Грид дефолтных аватаров */
.profile-avatar-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 0.8rem;
    justify-content: center;
}

.profile-avatar-option {
    width: 64px;
    height: 64px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.75;
    transition: transform 0.15s ease-out,
                box-shadow 0.15s ease-out,
                opacity 0.15s ease-out;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35);
}

.profile-avatar-option:hover {
    opacity: 0.95;
    transform: translateY(-1px) scale(1.03);
}

.profile-avatar-option.active {
    opacity: 1;
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 0 0 3px var(--accent, #3b82f6);
}

/* Секция кадрирования кастомного аватара */
.avatar-crop-section {
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
}

.avatar-crop-preview {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 1rem;
    background: radial-gradient(circle at 30% 20%, #1f2937, #020617);
    position: relative;
}

.avatar-crop-preview img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140%;
    height: 140%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    transition: transform 0.12s ease-out;
}

.avatar-crop-controls {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.avatar-crop-controls .form-label-modern {
    font-size: 0.8rem;
    color: var(--text-muted);
}


/* === Модалка кадрирования аватара === */
#avatarCropModal {
    z-index: 1100; /* чуть выше обычных модалок */
}

.avatar-crop-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

#avatarCropCanvas {
    border-radius: 50%;
    display: block;
    box-shadow: var(--shadow-md);
    background: radial-gradient(circle at 30% 20%, #1f2937, #020617);
}

.avatar-crop-sliders {
    max-width: 360px;
    margin: 0 auto;
}

.avatar-crop-sliders label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.avatar-crop-sliders input[type="range"] {
    width: 100%;
}

/* === CLEAN EXPAND TABLE LAYOUT === */

/* Контейнер модалки расширенной таблицы */
#tableExpandModal .modal-content-modern {
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#tableExpandModal .modal-header-modern,
#tableExpandModal .modal-footer-modern {
    flex: 0 0 auto;
}

#tableExpandModal .modal-body-modern {
    flex: 1 1 auto;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
    overflow-x: auto;              /* важно: разрешаем горизонтальный скролл */
    -webkit-overflow-scrolling: touch;
}

/* Обёртка с таблицей */
#tableExpandContent {
    width: 100%;
    max-width: 100%;
}

#tableExpandContent .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;              /* горизонтальный скролл по таблице */
}

/* Сама таблица — как на десктопе, но может быть шире экрана */
#tableExpandContent table {
    width: max-content;            /* ширина по содержимому */
    min-width: 100%;               /* но не меньше ширины экрана */
    table-layout: auto;            /* нормальная раскладка колонок */
    border-collapse: collapse;
}

/* Ячейки: без по-буквенного переноса, читаемый текст */
#tableExpandContent th,
#tableExpandContent td {
    white-space: nowrap;           /* не ломаем слова по буквам */
    word-break: normal;
    overflow-wrap: normal;
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    font-size: 0.8rem;
}

/* Мобильная подстройка — чуть компактнее, но всё ещё читаемо */
@media (max-width: 768px) {
    #tableExpandContent th,
    #tableExpandContent td {
        font-size: 0.75rem;
        padding: 0.35rem 0.55rem;
    }
}


#exerciseModal[data-input-mode="sliders"] .input-mode-sliders {
    display: flex !important;
}
#exerciseModal[data-input-mode="sliders"] .input-mode-text {
    display: none !important;
}

#exerciseModal[data-input-mode="text"] .input-mode-sliders {
    display: none !important;
}
#exerciseModal[data-input-mode="text"] .input-mode-text {
    display: flex !important;
}

.modal-footer-modern {
    position: relative;
}

.exercise-input-toggle-btn {
    position: absolute;
    right: 1rem;
    bottom: .75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.6rem;
}

@media (max-width: 576px) {
    .exercise-input-toggle-btn {
        right: .75rem;
        bottom: .5rem;
    }
}

/* скрытие ненужной группы */
.exercise-input-group--hidden {
    display: none !important;
}
