/**
 * ========================================
 * ФАЙЛ: /css/style.css
 * ОПИСАНИЕ: Основные стили приложения EcoRiver Alert
 * ========================================
 */

/* Базовые стили - без изменений... */
:root {
    --primary-color: #2E7D4A;
    --secondary-color: #4A90E2;
    --warning-color: #F5A623;
    --danger-color: #D0021B;
    --success-color: #2E7D4A;
    --text-dark: #333;
    --text-light: #666;
    --text-muted: #999;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --border-color: #ddd;
    --border-radius: 12px;
    --header-height: 60px;
    --nav-height: 65px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
}

/* ========================================
   MODAL WINDOW (НОВОЕ!)
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

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

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
    font-size: 20px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: var(--text-dark);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.modal-footer .btn {
    flex: 1;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 20px;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#userBadge {
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

/* ========================================
   PAGES
   ======================================== */
.page {
    display: none;
    padding-top: var(--header-height);
    padding-bottom: var(--nav-height);
    min-height: 100vh;
}

.page.active {
    display: block;
}

.container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

/* ========================================
   MAP STYLES
   ======================================== */
#map {
    height: calc(100vh - var(--header-height) - var(--nav-height));
    width: 100%;
}

.add-map {
    height: 350px;
    width: 100%;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ========================================
   FORMS
   ======================================== */
.form {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

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

.form-group label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 74, 0.1);
}

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

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-light);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #236038;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 74, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #3a7bc8;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #e09618;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #b00118;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   TYPE SELECTOR
   ======================================== */
.type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.type-btn {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.type-btn:hover {
    border-color: var(--primary-color);
}

.type-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert i {
    font-size: 20px;
}

.alert-info {
    background: #E3F2FD;
    color: #1565C0;
    border-left: 4px solid #1565C0;
}

.alert-warning {
    background: #FFF3E0;
    color: #E65100;
    border-left: 4px solid #E65100;
}

.alert-success {
    background: #E8F5E9;
    color: #2E7B32;
    border-left: 4px solid #2E7B32;
}

.alert-danger {
    background: #FFEBEE;
    color: #C62828;
    border-left: 4px solid #C62828;
}

/* ========================================
   MAP INSTRUCTIONS
   ======================================== */
.map-instructions {
    background: var(--secondary-color);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

/* ========================================
   PHOTO PREVIEW
   ======================================== */
.photo-preview {
    position: relative;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
}

.photo-preview img {
    width: 100%;
    display: block;
}

.btn-remove-photo {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(208, 2, 27, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-remove-photo:hover {
    background: var(--danger-color);
    transform: scale(1.1);
}

/* Остальные стили статистики, настроек и т.д. остаются прежними... */
/* Для краткости опущены, но они должны быть из предыдущей версии */

/* ========================================
   STATISTICS
   ======================================== */
.stats-header {
    margin-bottom: 20px;
}

.stats-header h2 {
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    transition: all 0.3s;
}

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

.stat-green {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
}

.stat-yellow {
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
}

.stat-red {
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
}

.stat-icon {
    font-size: 32px;
}

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

.stat-yellow .stat-icon {
    color: var(--warning-color);
}

.stat-red .stat-icon {
    color: var(--danger-color);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

.progress-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.progress-bar {
    height: 12px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.progress-green {
    background: var(--success-color);
}

.progress-yellow {
    background: var(--warning-color);
}

.progress-red {
    background: var(--danger-color);
}

.recent-marks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-mark-item {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.recent-mark-item:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.recent-mark-item.level-green {
    border-left-color: var(--success-color);
}

.recent-mark-item.level-yellow {
    border-left-color: var(--warning-color);
}

.recent-mark-item.level-red {
    border-left-color: var(--danger-color);
}

.recent-mark-title {
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-mark-info {
    font-size: 12px;
    color: var(--text-light);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* SETTINGS + AUTH + NAVIGATION - копировать из предыдущей версии */

.settings-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.settings-card h3 {
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
}

.detail-item i {
    font-size: 20px;
    color: var(--primary-color);
}

.detail-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.detail-value {
    font-weight: 600;
    color: var(--text-dark);
}

.welcome-message {
    text-align: center;
    margin-bottom: 20px;
}

.welcome-message i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.welcome-message h3 {
    margin-bottom: 10px;
}

.welcome-message p {
    color: var(--text-light);
}

.about-content {
    line-height: 1.6;
}

.about-content p {
    margin-bottom: 15px;
}

.text-muted {
    color: var(--text-muted);
}

.app-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}

.auth-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 400px;
    margin: 0 auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.auth-header h2 {
    color: var(--text-dark);
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

.auth-footer p {
    margin: 10px 0;
    color: var(--text-light);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 5px 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.3s;
    flex: 1;
    max-width: 100px;
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-item span {
    font-size: 12px;
}

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

.nav-item.active {
    color: var(--primary-color);
    background: rgba(46, 125, 74, 0.1);
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 15px;
    min-width: 200px;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .stat-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    #userBadge {
        font-size: 12px;
        padding: 4px 10px;
    }
    
    .modal-content {
        max-height: 95vh;
    }
}

@media (max-width: 480px) {
    .type-selector {
        flex-direction: column;
    }
    
    .auth-card {
        padding: 20px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 20px;
}

.mb-2 {
    margin-bottom: 20px;
}

.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}