/* Сброс и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #ff6b00;       /* Оранжевый - основной */
    --secondary-color: #0088cc;     /* Синий - вторичный */
    --danger-color: #ff4444;        /* Красный - опасность */
    --success-color: #00cc66;       /* Зеленый - успех */
    --warning-color: #ffaa00;       /* Желтый - предупреждение */
    
    --bg-dark: #0a1a2a;             /* Темный фон */
    --bg-darker: #05111f;           /* Еще темнее */
    --bg-light: #1a2b3c;            /* Светлый на темном */
    --bg-lighter: #2a3b4c;          /* Еще светлее */
    
    --text-primary: #ffffff;        /* Основной текст */
    --text-secondary: #a0b0c0;      /* Вторичный текст */
    --text-muted: #708090;          /* Нейтральный текст */
    
    --border-color: #2a3b4c;        /* Цвет границ */
    --shadow-color: rgba(0, 0, 0, 0.5);
    
    --font-main: 'Roboto', sans-serif;
    --font-condensed: 'Roboto Condensed', sans-serif;
    
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
    font-size: 16px;
    line-height: 1.5;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-darker);
    position: relative;
}

/* Статус бар */
.status-bar {
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-darker));
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow-color);
    height: 70px;
    z-index: 1000;
}

.status-left, .status-right {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 200px;
}

.status-center {
    flex: 1;
    text-align: center;
}

.gps-status, .train-info, .connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: var(--bg-light);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--primary-color);
}

.gps-icon, .signal-icon {
    font-size: 1.3em;
}

.time-display {
    text-align: center;
    background: var(--bg-light);
    padding: 8px 15px;
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--secondary-color);
}

.time {
    font-size: 1.4em;
    font-weight: 700;
    display: block;
    font-family: var(--font-condensed);
}

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

.train-number {
    font-weight: 700;
    font-size: 1.2em;
    color: var(--primary-color);
    font-family: var(--font-condensed);
}

.train-speed {
    font-size: 1.8em;
    font-weight: 700;
    background: linear-gradient(45deg, var(--success-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0 10px;
}

.signal {
    display: flex;
    align-items: center;
    gap: 5px;
}

.battery {
    width: 80px;
    height: 30px;
    background: var(--bg-lighter);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.battery-level {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #00ff88);
    border-radius: 15px;
    transition: width 0.5s ease;
}

.battery-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Основная область */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.map-container {
    flex: 1;
    background: var(--bg-light);
    position: relative;
    margin: 10px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

.map-controls {
    position: absolute;
    right: 15px;
    top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.map-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(10, 26, 42, 0.85);
    border: 2px solid var(--primary-color);
    color: var(--text-primary);
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.map-btn:active {
    transform: scale(0.95);
    background: var(--primary-color);
}

.compass {
    position: absolute;
    left: 15px;
    top: 15px;
    width: 60px;
    height: 60px;
    background: rgba(10, 26, 42, 0.85);
    border-radius: 50%;
    border: 2px solid var(--secondary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.compass-arrow {
    font-size: 1.8em;
    color: var(--primary-color);
}

.compass-degree {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: -5px;
}

/* Информационная панель */
.info-panel {
    display: flex;
    background: var(--bg-light);
    margin: 0 10px 10px;
    border-radius: var(--border-radius);
    padding: 15px;
    gap: 20px;
    border: 2px solid var(--border-color);
}

.next-station, .speed-limits {
    flex: 1;
    padding: 15px;
    background: var(--bg-darker);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--secondary-color);
}

.next-station {
    border-left-color: var(--success-color);
}

.station-name {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--success-color);
    margin-bottom: 8px;
    font-family: var(--font-condensed);
}

.distance, .eta {
    font-size: 1.1em;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.current-limit, .next-limit {
    margin-bottom: 10px;
}

.limit-label {
    color: var(--text-secondary);
    font-size: 0.95em;
}

.limit-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
    float: right;
}

.next-limit .limit-value {
    color: var(--warning-color);
}

/* Панель управления */
.control-panel {
    background: linear-gradient(to top, var(--bg-dark), var(--bg-darker));
    padding: 15px 20px;
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -2px 10px var(--shadow-color);
}

.primary-controls, .secondary-controls {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

.control-btn {
    flex: 1;
    min-height: 70px;
    background: linear-gradient(145deg, var(--bg-light), var(--bg-lighter));
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-condensed);
    font-weight: 700;
    font-size: 1.1em;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px var(--shadow-color);
    padding: 10px;
}

.control-btn.large {
    min-height: 90px;
    font-size: 1.2em;
}

.control-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px var(--shadow-color);
    background: linear-gradient(145deg, var(--bg-lighter), var(--bg-light));
}

.control-btn.emergency {
    background: linear-gradient(145deg, #ff4444, #cc0000);
    border-color: #ff7777;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.btn-icon {
    font-size: 1.8em;
}

.btn-text {
    font-size: 0.9em;
    text-align: center;
}

/* Боковое меню */
.side-menu {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100%;
    background: var(--bg-dark);
    border-left: 3px solid var(--primary-color);
    box-shadow: -5px 0 25px var(--shadow-color);
    z-index: 2000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.side-menu.active {
    right: 0;
}

.menu-header {
    background: var(--bg-darker);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
}

.menu-header h2 {
    color: var(--primary-color);
    font-family: var(--font-condensed);
    font-size: 1.3em;
}

.close-menu {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 10px;
}

.menu-content {
    padding: 20px;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-condensed);
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-light);
    margin-bottom: 10px;
    border-radius: var(--border-radius-sm);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.menu-item:hover {
    border-left-color: var(--primary-color);
    background: var(--bg-lighter);
}

.small-btn {
    padding: 5px 12px;
    background: var(--secondary-color);
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9em;
}

.toggle {
    position: relative;
    width: 50px;
    height: 26px;
}

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

.toggle label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-lighter);
    border-radius: 34px;
    transition: .4s;
}

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

.toggle input:checked + label {
    background-color: var(--success-color);
}

.toggle input:checked + label:before {
    transform: translateX(24px);
}

/* Системные уведомления */
.system-alerts {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 350px;
    z-index: 3000;
}

.alert {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-darker));
    border-left: 5px solid var(--warning-color);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 15px var(--shadow-color);
    animation: slideIn 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert.warning {
    border-left-color: var(--warning-color);
}

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

.alert.success {
    border-left-color: var(--success-color);
}

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