/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* --- Основная светлая тема (теперь единственная) --- */
    --primary-color: #43A047;
    --primary-light: #66BB6A;
    --primary-dark: #2E7D32;
    
    --secondary-color: #2196F3;
    --secondary-light: #64B5F6;
    --secondary-dark: #1976D2;
    
    --tertiary-color: #757575;
    --tertiary-light: #BDBDBD;
    --tertiary-dark: #616161;
    
    --text-color: #212121;
    --text-secondary: #555;
    
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --input-border: #e5e5e5;
    
    --white: #fff;
    
    --danger-color: #D32F2F;
    --danger-bg: #ffebee;
    --danger-border: #ef9a9a;
    
    --success-color: #66BB6A;
    --success-text: #2e7d32;
    --success-bg: #e8f5e9;
    --success-border: #a5d6a7;
    
    --login-bg-gradient: #fafafa;
    --header-gradient: var(--primary-color);
    
    --shadow-color: rgba(0, 0, 0, 0.04);
    --box-shadow: 0 1px 3px var(--shadow-color);
    --button-shadow: none;
    --button-hover-shadow: 0 2px 4px var(--shadow-color);
    --input-shadow: none;
    
    --border-radius-main: 12px;
    --border-radius-small: 6px;
    --bottom-nav-height: 70px;
    --bottom-nav-height-mobile: 60px;
    
    --map-filter: none;
    
    --list-item-border: #eee;
    --border-separator: #eee;
    
    --theme-btn-bg: rgba(255, 255, 255, 0.8);
    --theme-btn-color: #555;
}

/* --- Темная тема удалена полностью --- */

html {
    scroll-behavior: smooth;
}

html, body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    font-size: 16px;
    line-height: 1.6;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
    min-height: 100vh;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Стили для страницы входа */
body.login-page-body {
    background: var(--login-bg-gradient);
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.login-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0;
}

.login-header {
    width: 100%;
    text-align: center;
    margin-bottom: 56px;
    position: relative;
}

.login-logo {
    width: 64px;
    height: auto;
    margin-bottom: 24px;
    border-radius: 0;
}

.login-header h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: -0.02em;
}

.login-subtitle {
    margin: 0 0 0 0;
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.6;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.login-language-switcher {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    padding: 0;
    gap: 4px;
    display: flex;
    align-items: center;
}
.login-language-switcher a,
.login-language-switcher a.active {
    color: var(--text-secondary) !important;
    font-size: 14px;
    padding: 4px 8px;
    text-decoration: none;
    border-radius: 4px;
    transition: color 0.2s ease;
    font-weight: 500;
    background-color: transparent !important;
}
.login-language-switcher a:hover {
    color: var(--text-color) !important;
}
.login-language-switcher a.active {
    color: var(--primary-color) !important;
}

.login-language-switcher span {
     color: var(--input-border);
     font-size: 12px;
     padding: 0 2px;
}

.login-card {
    background-color: var(--card-bg);
    padding: 48px 40px;
    border-radius: 12px;
    border: 1px solid var(--input-border);
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
}

.login-card h2.welcome-heading {
    font-size: 24px;
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 16px;
    border-bottom: none;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.login-card .welcome-text {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
    text-align: left;
}

.login-card .welcome-text:last-of-type {
    margin-bottom: 32px;
}

.login-card h3 {
    font-size: 20px;
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.register-choice-text {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 15px;
    font-weight: 400;
}

.login-card .buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 0;
    text-align: center;
}

.login-card .button {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-login {
     background: var(--primary-color);
     color: #fff;
}
.button-login:hover {
     background: var(--primary-dark);
}

.button-register {
     background: var(--text-color);
     color: #fff;
}
.button-register:hover {
     background: var(--tertiary-dark);
}

.button-link {
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
    border: none;
    padding: 12px 24px;
    font-weight: 400;
}
.button-link:hover {
     color: var(--text-color);
     background: transparent;
}

.login-card .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

.login-card .form-group input,
.login-card .form-group select {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    box-shadow: none;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    box-sizing: border-box;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-family: inherit;
    transition: border-color 0.2s ease;
}
.login-card .form-group input:focus,
.login-card .form-group select:focus {
     outline: none;
     border-color: var(--primary-color);
     box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.login-card .form-group input[type="number"] {
     -moz-appearance: textfield;
}
.login-card .form-group input[type="number"]::-webkit-outer-spin-button,
.login-card .form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.login-card .form-group small {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    display: block;
    line-height: 1.4;
}

.login-card .remember-me-group {
    display: flex;
    align-items: center;
    margin-top: 8px;
    margin-bottom: 0;
}
.login-card .remember-me-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    box-shadow: none;
    cursor: pointer;
}
.login-card .remember-me-group label {
    margin-bottom: 0;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 400;
}

.login-card .registration-buttons {
     display: flex;
     flex-direction: column;
     width: 100%;
     gap: 12px;
     margin-top: 0;
}
.login-card .registration-buttons .button {
    width: 100%;
}

.login-card .form-container .buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}


.container {
    width: 95%;
    max-width: 1400px;
    margin: 20px auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.info-circle-btn {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 30px);
    right: 20px;
    width: 56px;
    height: 56px;
    background-color: var(--secondary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.7em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    z-index: 999;
}

.info-circle-btn:hover {
    background-color: var(--secondary-dark);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card {
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    box-shadow: none;
    margin-bottom: 24px;
}

.info-card h3 {
    color: var(--text-color);
    margin-top: 32px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--input-border);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.info-card ul { list-style: none; padding-left: 0; }
.info-card li { margin-bottom: 12px; display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.info-card li i { margin-top: 4px; width: 20px; text-align: center; color: var(--primary-color); }
.info-card li b { color: var(--primary-dark); }


header {
    background: var(--header-gradient);
    color: #fff;
    padding: 15px 25px;
    text-align: center;
    border-radius: 0 0 var(--border-radius-main) var(--border-radius-main);
    margin-bottom: 25px;
    position: relative;
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 2.2em;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    flex-grow: 1;
    text-align: left;
}

header .header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.language-switcher {
    display: flex;
    gap: 5px;
    background-color: rgba(0,0,0,0.1);
    padding: 5px 10px;
    border-radius: var(--border-radius-small);
}

.language-switcher a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
    padding: 2px 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.language-switcher a:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.1);
}

.language-switcher a.active {
    color: var(--primary-dark);
    background-color: #fff;
}


header .user-info {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
}
header .user-info a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s ease;
}
header .user-info a:hover {
    color: #fff;
    text-decoration: underline;
}

.announcement-bar {
    background-color: var(--danger-color);
    color: white;
    padding: 12px 5px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.announcement-bar marquee {
    font-weight: 500;
    font-size: 1.1em;
}


/* Общие стили для кнопок */
.button, button {
    background: var(--primary-color);
    color: #fff;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
    font-weight: 500;
    min-width: 120px;
    gap: 8px;
    font-family: inherit;
}

.button:hover, button:hover {
    background: var(--primary-dark);
    box-shadow: var(--button-hover-shadow);
}

.button:disabled, button:disabled {
    background: var(--input-border);
    cursor: not-allowed;
    box-shadow: none;
    color: var(--text-secondary);
    opacity: 0.6;
}

.button-secondary {
    background: var(--secondary-color);
}
.button-secondary:hover {
    background: var(--secondary-dark);
}

.button-danger {
    background: var(--danger-color);
}
.button-danger:hover {
    background: #b71c1c;
}

.button-telegram {
    background: #0088CC;
}
.button-telegram:hover {
    background: #0077B3;
}

.button-tertiary { 
    background: var(--tertiary-color);
}
.button-tertiary:hover {
    background: var(--tertiary-dark);
}

.button-small {
    padding: 8px 16px;
    font-size: 0.9em;
    min-width: auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: var(--border-radius-main);
    box-shadow: 0 4px 20px rgba(67, 160, 71, 0.15), 0 2px 8px rgba(67, 160, 71, 0.1);
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.dashboard-header-title {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-icon-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    font-size: 1.5em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.profile-icon-wrapper:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.notification-icon-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    font-size: 1.5em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.notification-icon-wrapper:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.dashboard-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 0;
    max-width: 1200px;
    width: 100%;
}


.dashboard-nav i {
    font-size: 1.4em;
    margin: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.nav-button-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 200px;
    max-width: 280px;
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.nav-button-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-button-wrapper:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    transform: translateY(-4px);
    border-color: rgba(67, 160, 71, 0.2);
}

.nav-button-wrapper:hover::before {
    opacity: 1;
}

.dashboard-nav .button-nav {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: #fff;
    padding: 18px 24px;
    border-radius: 12px;
    width: 100%;
    font-size: 1.15em;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    text-decoration: none;
    border: none;
    box-shadow: 0 2px 8px rgba(67, 160, 71, 0.2), 0 1px 3px rgba(67, 160, 71, 0.15);
    position: relative;
    overflow: hidden;
}

.dashboard-nav .button-nav::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 ease;
}

.dashboard-nav .button-nav:hover::before {
    left: 100%;
}

.dashboard-nav .button-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 160, 71, 0.3), 0 3px 8px rgba(67, 160, 71, 0.2);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.dashboard-nav .button-nav:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(67, 160, 71, 0.2);
}

.nav-button-desc {
    margin-top: 16px;
    font-size: 0.875em;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    padding: 0;
    margin-bottom: 0;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.nav-button-wrapper:hover .nav-button-desc {
    opacity: 1;
    color: var(--text-color);
}

.quick-overview {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
}

.quick-overview h2 {
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.overview-grid {
    display: flex;
    justify-content: space-around;
    text-align: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.overview-item {
    background-color: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: var(--border-radius-main);
    flex: 1;
    min-width: 150px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.overview-item:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
}

.overview-item i {
    font-size: 2.5em;
    margin-bottom: 10px;
    opacity: 0.9;
}

.overview-item span {
    display: block;
    font-size: 2.2em;
    font-weight: bold;
    line-height: 1.2;
}

.overview-item p {
    margin: 5px 0 0;
    font-size: 1em;
    opacity: 0.9;
}


.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-dark);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-small);
    font-size: 1em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius-small);
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger-color);
    border-color: var(--danger-border);
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

#map {
    height: 70vh;
    width: 100%;
    border-radius: var(--border-radius-main);
    box-shadow: var(--box-shadow);
    z-index: 1;
    position: relative;
    background-color: #aad3df; /* Цвет воды по умолчанию */
}

.map-controls-group {
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: var(--border-radius-main);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.map-controls-group .map-control label {
    font-size: 0.9em;
    color: var(--text-color);
    font-weight: 500;
}

.map-controls-group .map-control select {
    padding: 8px;
    border-radius: var(--border-radius-small);
    border: 1px solid var(--input-border);
    font-size: 0.9em;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.leaflet-control-container .leaflet-draw-toolbar, .leaflet-control-container .leaflet-draw-actions {
    background-color: var(--card-bg);
    border: none;
    border-radius: var(--border-radius-small);
    box-shadow: var(--button-shadow);
    padding: 5px;
    color: var(--primary-dark);
}

.leaflet-draw-toolbar a {
    color: var(--primary-dark) !important;
}

.leaflet-pane.leaflet-overlay-pane path {
    stroke: rgba(0, 0, 0, 0.7) !important;
    stroke-width: 1.5px !important;
}

.territory-label {
    background-color: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    text-align: center;
    box-shadow: none;
    transform: translate(-50%, -50%);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}

.main-content {
    flex: 3 1 600px;
    display: flex;
    flex-direction: column;
    min-width: 280px;
}

.sidebar {
    flex: 1 1 300px;
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius-main);
    box-shadow: var(--box-shadow);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    min-width: 250px;
}

.sidebar h3, h2 {
    color: var(--primary-dark);
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 500;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: var(--border-radius-small);
    border: 1px solid var(--list-item-border);
    font-size: 0.95em;
    line-height: 1.5;
    box-shadow: 0 2px 8px var(--shadow-color);
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.list-item .item-title {
    font-weight: 500;
}
.list-item .item-meta {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 2px;
}
.list-item .item-actions {
    display: flex;
    gap: 8px;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-separator);
    margin-bottom: 10px;
    font-size: 1.2em;
    color: var(--primary-dark);
}

.collapsible-content {
    display: none;
    animation: fadeIn 0.4s ease;
}
.collapsible-content.active {
    display: block;
}

.search-container {
    margin-bottom: 15px;
}

.search-container input {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border-radius: var(--border-radius-small);
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-color);
}

footer {
    text-align: center;
    margin-top: auto;
    padding: 15px;
    color: var(--tertiary-color);
    font-size: 0.9em;
    border-top: 1px solid var(--border-separator);
    width: 100%;
    box-sizing: border-box;
}

#ajax-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10000;
    display: none;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-separator);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 5px;
}

.tab-button {
    padding: 12px 18px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-size: 1.05em;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-button:hover {
    background-color: var(--input-bg);
}

.tab-button.active {
    border-bottom: 3px solid var(--primary-color);
    font-weight: 500;
    color: var(--text-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border: 1px solid var(--border-separator);
    border-radius: var(--border-radius-main);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--box-shadow);
    animation: zoomIn 0.3s ease;
    color: var(--text-color);
}

.profile-modal-content {
    max-width: 600px;
}

.assistants-list {
    margin-top: 20px;
}

.assistant-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-small);
    gap: 15px;
    flex-wrap: wrap;
    box-sizing: border-box;
}

.assistant-item span:first-child {
    flex: 1;
    font-weight: 500;
    min-width: 0;
}

.assistant-item .button-small {
    flex-shrink: 0;
}

.button-small {
    padding: 8px 16px;
    font-size: 0.9em;
    white-space: nowrap;
    box-sizing: border-box;
}

.permission-status {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

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

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

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    transition: color 0.2s;
}

.close-button:hover, .close-button:focus {
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
}

.welcome-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-section h2 {
    font-size: 1.8em;
    color: var(--primary-dark);
    margin-bottom: 20px;
    border-bottom: none;
    margin-top: 0;
}

.welcome-section p {
    font-size: 1.05em;
    color: var(--text-secondary);
    margin-bottom: 25px;
    line-height: 1.5;
}

.welcome-section .buttons {
    margin-top: 20px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    width: 100%;
}

.registration-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    flex-direction: row;
    width: 100%;
}
.login-card .registration-buttons .button {
    flex: 1 1 auto;
    min-width: 140px;
}

.telegram-integration-card {
    margin-top: 20px;
    text-align: center;
}
.button-telegram {
    background: linear-gradient(45deg, #0088CC, #0077B3);
    padding: 15px 30px;
    font-size: 1.1em;
    box-shadow: 0 4px 10px rgba(0, 136, 204, 0.3);
}
.button-telegram:hover {
    background: linear-gradient(45deg, #0077B3, #0088CC);
    box-shadow: 0 6px 15px rgba(0, 136, 204, 0.4);
    transform: translateY(-2px);
}
.telegram-instruction {
    text-align: left;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-separator);
}
.telegram-instruction h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
    color: var(--text-color);
}
.telegram-instruction ol {
    margin: 0;
    padding-left: 20px;
}
.telegram-instruction li {
    margin-bottom: 10px;
}
.telegram-instruction code {
    background-color: var(--input-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: var(--danger-color);
    border: 1px solid var(--border-separator);
}

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

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}


.login-footer {
    margin-top: 56px;
    padding: 32px 0;
    text-align: center;
    width: 100%;
    max-width: 420px;
}

.login-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.login-footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    transition: color 0.2s ease;
}

.login-footer-links a:hover {
    color: var(--primary-color);
}

.login-footer-links span {
    color: var(--input-border);
    font-size: 12px;
}

@media(min-width: 769px) {
     body.login-page-body {
         padding: 40px;
     }
     .login-container {
         max-width: 420px;
     }
     .login-header {
         margin-bottom: 48px;
     }
}


@media(max-width: 768px) {
    body {
        padding-bottom: calc(var(--bottom-nav-height-mobile) + 20px);
    }
    
    /* Исправление кнопок на средних экранах */
    .assistant-item {
        flex-wrap: wrap;
    }
    
    .assistant-item .button-small {
        white-space: normal;
        font-size: 0.85em;
        padding: 8px 12px;
        min-width: 120px;
        box-sizing: border-box;
    }
    
    .button-primary,
    .button.button-primary {
        font-size: 0.95em;
        padding: 14px 18px;
        box-sizing: border-box;
    }

    .login-header {
        margin-bottom: 32px;
    }
    
    .login-logo {
        width: 56px;
        height: auto;
        margin-bottom: 20px;
    }
    
    .login-header h1 {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .login-subtitle {
        font-size: 14px;
    }
    
    .login-language-switcher {
        position: static;
        margin: 12px 0 0 0;
        justify-content: center;
    }

    .login-container { 
        padding: 5px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .login-card {
        padding: 32px 24px;
    }
    
    .login-footer {
        margin-top: 32px;
        padding: 20px 0;
    }

    header {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    header h1 {
        font-size: 1.8em;
        text-align: center;
    }
    header .header-controls {
        flex-direction: column;
        gap: 10px;
    }
    .container {
        width: 98%;
    }
    
    .dashboard-header {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .dashboard-header-title {
        font-size: 22px;
    }
    
    .dashboard-nav {
        gap: 15px;
    }
    
    .nav-button-wrapper {
        max-width: 100%;
        padding: 20px;
    }
    
    .notification-icon-wrapper {
        width: 44px;
        height: 44px;
        font-size: 1.4em;
    }
    
    .notification-badge {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    
    .info-circle-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
        bottom: calc(var(--bottom-nav-height-mobile) + 25px);
        right: 15px;
    }

    .card {
        padding: 1.5rem;
    }

    .login-wrapper {
        width: 100%;
        padding: 0;
        box-sizing: border-box;
    }

    .login-card {
        padding: 32px 24px;
        margin-bottom: 0;
    }
    
    .login-card h2.welcome-heading {
         font-size: 22px;
         margin-bottom: 12px;
    }
    
    .login-card .welcome-text {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .login-card .welcome-text:last-of-type {
        margin-bottom: 24px;
    }
    
    .login-card h3 {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .login-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .login-buttons .button {
        width: 100%;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 0.9em;
        margin-bottom: 5px;
    }
    
    .form-group input,
    .form-group select {
        font-size: 0.95em;
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 15px;
    }
    
    .buttons .button {
        width: 100%;
    }
    
    .registration-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .registration-buttons .button {
        width: 100%;
    }
    
     /* Стили для login-card уже добавлены выше */


    .dashboard-nav .button-nav {
        font-size: 1em;
        padding: 15px 20px;
    }

    .dashboard-nav i {
        font-size: 1.2em;
    }
    
    .nav-button-wrapper {
        max-width: 100%;
        flex: 1 1 100%;
        padding: 18px;
        box-sizing: border-box;
    }
    
    .dashboard-nav .button-nav {
        padding: 16px 20px;
        font-size: 1.05em;
    }
    
    .dashboard-nav i {
        font-size: 1.3em;
    }
    
    .nav-button-desc {
        font-size: 0.85em;
        margin-top: 14px;
    }

    h2, h3 {
        font-size: 1.2em;
    }

    .page-title {
        font-size: 1.5em;
    }

    .bottom-nav {
        height: var(--bottom-nav-height-mobile);
    }
    .nav-item i {
        font-size: 1.3em;
    }
    .nav-item span {
        font-size: 0.7em;
    }
     .language-switcher-bottom {
         font-size: 1.3em;
     }
     .language-switcher-bottom a {
         font-size: 0.7em;
     }
}

/* Дополнительные стили для очень маленьких экранов (до 480px) */
@media(max-width: 480px) {
    .login-header h1 {
        font-size: 22px;
    }
    
    .login-logo {
        width: 48px;
    }
    
    .login-subtitle {
        font-size: 13px;
    }
    
    .login-card {
        padding: 24px 20px;
    }
    
    .login-card h2.welcome-heading {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .login-card .welcome-text {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .login-card .welcome-text:last-of-type {
        margin-bottom: 20px;
    }
    
    .login-card h3 {
        font-size: 17px;
    }
    
    .form-group input,
    .form-group select {
        font-size: 16px; /* Предотвращает зум на iOS */
    }
    
    /* Исправление кнопок на маленьких экранах */
    .assistant-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .assistant-item > div {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .assistant-item .button-small {
        width: 100%;
        white-space: normal;
        padding: 10px 12px;
        font-size: 0.85em;
        text-align: center;
    }
    
    /* Кнопка генерации PDF отчета */
    .button-primary,
    .button.button-primary {
        font-size: 0.9em;
        padding: 12px 16px;
        white-space: normal;
        word-wrap: break-word;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-sizing: border-box;
    }
}

/* На очень маленьких экранах (до 360px) скрываем текст кнопки генерации отчета, оставляем только иконку */
@media(max-width: 360px) {
    .generate-report-btn .generate-report-text {
        display: none;
    }
    
    .generate-report-btn {
        justify-content: center;
    }
    
    .generate-report-btn i {
        margin: 0;
    }
    
    /* Кнопка в модальном окне - остается на всю ширину (инлайн стиль имеет приоритет), но показывает только иконку */
    .button-primary.generate-report-btn,
    .button.button-primary.generate-report-btn {
        padding: 12px 16px;
    }
    
    /* Кнопка в заголовке - компактный размер */
    #export-register-btn.generate-report-btn {
        min-width: 44px;
        padding: 8px 12px;
        width: auto;
    }
}

/* --- Стили для псевдо-полноэкранного режима --- */
body.pseudo-fullscreen-active {
    overflow: hidden;
    padding-bottom: 0;
}
body.pseudo-fullscreen-active header,
body.pseudo-fullscreen-active footer,
body.pseudo-fullscreen-active .bottom-nav {
    display: none;
}
body.pseudo-fullscreen-active .container > *:not(.main-content) {
    display: none;
}
body.pseudo-fullscreen-active .container > .page-title {
    display: none;
}
body.pseudo-fullscreen-active .main-content > *:not(#map) {
    display: none;
}
body.pseudo-fullscreen-active #map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    z-index: 5000;
}

/* --- H1 --- */
.page-title {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 32px;
    font-weight: 600;
    font-size: 28px;
    padding-bottom: 0;
    border-bottom: none;
    display: block;
    letter-spacing: -0.02em;
}

/* --- Нижняя навигация --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background-color: var(--card-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 5px 0;
    box-shadow: 0 -4px 15px var(--shadow-color);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 1000;
    border-top: 1px solid var(--border-separator);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-secondary); /* #212121 -> --text-secondary для неактивных */
    text-decoration: none;
    padding: 5px;
    transition: color 0.2s ease;
    text-align: center;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-item i {
    font-size: 1.5em;
    margin-bottom: 4px;
    color: var(--primary-dark);
}

.nav-item span {
    font-size: 0.8em;
    font-weight: 500;
}

.nav-item:hover {
    color: var(--primary-color);
}
.nav-item:hover i {
    color: var(--primary-color);
}

.nav-item.active {
    color: var(--primary-color);
}
.nav-item.active i {
    color: var(--primary-color);
}

.language-switcher-bottom {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: bold;
    color: var(--primary-light);
    font-size: 1.5em;
    margin-bottom: 4px;
}

.language-switcher-bottom a {
    color: #999; /* Оставил как в оригинале для светлой темы */
    text-decoration: none;
    font-size: 0.8em;
    padding: 5px;
    border-radius: 4px;
}

.language-switcher-bottom a:hover {
    color: var(--primary-dark);
}

.language-switcher-bottom a.active {
    color: var(--white);
    background-color: var(--primary-color);
}
.language-switcher-bottom + span {
    font-size: 0.8em;
    font-weight: 500;
}
/* Кнопка темы удалена */

/* Стили для кнопок действий с территориями */
.territory-action-btn {
    padding: 8px 14px !important;
    font-size: 0.85em !important;
    min-width: auto !important;
    white-space: nowrap !important;
    gap: 6px !important;
}

.territory-action-btn .btn-text {
    font-size: 0.9em;
    font-weight: 500;
}

.territory-action-btn i {
    font-size: 0.95em;
}

@media (max-width: 768px) {
    .territory-action-btn {
        padding: 6px 10px !important;
        font-size: 0.8em !important;
    }
    
    .territory-action-btn .btn-text {
        font-size: 0.85em;
    }
}