* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Левая панель */
.sidebar {
    width: 320px;
    background: white;
    overflow-y: auto;
    border-right: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 600;
}

/* Статус устройства */
.device-status {
    padding: 15px;
    background: #f8f9fa;
    margin: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.status-header h3 {
    font-size: 14px;
    color: #333;
}

.alarm-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e8f5e9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.alarm-icon.active {
    background: #ffebee;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.device-info {
    font-size: 13px;
    color: #555;
    line-height: 1.8;
}

.device-info p {
    margin: 5px 0;
}

.device-info span {
    font-weight: 600;
    color: #333;
}

.status-safe {
    color: #4caf50;
    font-weight: bold;
}

.status-warning {
    color: #ff9800;
    font-weight: bold;
}

.status-danger {
    color: #f44336;
    font-weight: bold;
}

/* Разделы */
.zones-section,
.home-settings,
.simulation,
.drawing-section {
    padding: 15px;
    margin: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.zones-section h3,
.home-settings h3,
.simulation h3,
.drawing-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #333;
    font-weight: 600;
}

/* Управление зонами */
.zone-controls {
    margin-bottom: 10px;
}

.zones-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zone-item {
    padding: 10px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.zone-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
}

.zone-item.restricted {
    border-left-color: #f44336;
}

.zone-item.warning {
    border-left-color: #ff9800;
}

.zone-item.safe {
    border-left-color: #4caf50;
}

.zone-info {
    flex: 1;
}

.zone-name {
    font-weight: 600;
    color: #333;
}

.zone-type {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.zone-delete {
    background: #ffebee;
    color: #f44336;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.zone-delete:hover {
    background: #f44336;
    color: white;
}

/* Форма */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Кнопки */
.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    margin-top: 5px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-success:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-danger:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Основной контент */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

/* Алерты */
.alert-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 350px;
    z-index: 1000;
    pointer-events: none;
}

.alert {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    font-weight: 600;
    animation: slideIn 0.3s ease;
    pointer-events: all;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-danger {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.alert-warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.alert-success {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
}

.alert-info {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

/* Прокрутка */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Рисование */
.drawing-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.drawing-controls .btn {
    flex: 1;
    margin-top: 0;
}

.drawing-stats {
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    color: #666;
    border-left: 3px solid #667eea;
}

/* Leaflet Draw переопределения */
.leaflet-draw-toolbar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 5px;
}

.leaflet-draw-toolbar a {
    background-color: white;
    border-color: #ddd;
}

.leaflet-draw-toolbar a:hover {
    background-color: #f0f0f0;
}

.leaflet-draw-toolbar a.leaflet-disabled {
    background-color: #f8f8f8;
    opacity: 0.5;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 40%;
    }

    .main-content {
        height: 60%;
    }

    .alert-container {
        width: 90%;
        left: 5%;
        right: auto;
    }
}
