/* components.css */
/* Дополнительные компоненты для кабинного навигатора */

/* ===== КНОПКИ И ИНТЕРФЕЙСНЫЕ ЭЛЕМЕНТЫ ===== */

/* Большие кабинные кнопки */
.cab-button {
    min-height: 80px;
    min-width: 120px;
    background: linear-gradient(145deg, var(--bg-light), var(--bg-lighter));
    border: 3px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-primary);
    font-family: var(--font-condensed);
    font-weight: 700;
    font-size: 1.2em;
    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),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    padding: 15px;
    margin: 5px;
    position: relative;
    overflow: hidden;
}

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

.cab-button.primary {
    background: linear-gradient(145deg, var(--primary-color), #ff8c00);
    border-color: #ff944d;
}

.cab-button.secondary {
    background: linear-gradient(145deg, var(--secondary-color), #0099ff);
    border-color: #66ccff;
}

.cab-button.danger {
    background: linear-gradient(145deg, var(--danger-color), #ff0000);
    border-color: #ff6666;
    animation: pulse-alert 1.5s infinite;
}

.cab-button.warning {
    background: linear-gradient(145deg, var(--warning-color), #ffcc00);
    border-color: #ffdd66;
}

.cab-button.success {
    background: linear-gradient(145deg, var(--success-color), #00ff88);
    border-color: #66ffaa;
}

/* Активные кнопки с подсветкой */
.cab-button.active {
    box-shadow: 
        0 0 20px rgba(255, 107, 0, 0.5),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Кнопки с иконками */
.button-icon {
    font-size: 2em;
    margin-bottom: 5px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.button-text {
    font-size: 0.9em;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.button-subtext {
    font-size: 0.7em;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== ПАНЕЛИ И КОНТЕЙНЕРЫ ===== */

/* Карточка информации */
.info-card {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-darker));
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 10px 0;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 15px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), transparent);
}

.info-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.info-card-title {
    font-family: var(--font-condensed);
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-color);
}

.info-card-value {
    font-size: 2em;
    font-weight: 700;
    text-align: center;
    margin: 15px 0;
    font-family: var(--font-condensed);
}

.info-card-unit {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-left: 5px;
}

/* Панель статуса */
.status-panel {
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-darker));
    border-radius: var(--border-radius);
    padding: 15px;
    border: 2px solid var(--border-color);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: var(--bg-light);
    border-radius: var(--border-radius-sm);
}

.status-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.status-value {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-primary);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

.status-good {
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.status-warning {
    background-color: var(--warning-color);
    box-shadow: 0 0 8px var(--warning-color);
    animation: blink 1s infinite;
}

.status-danger {
    background-color: var(--danger-color);
    box-shadow: 0 0 8px var(--danger-color);
    animation: pulse-alert 0.5s infinite;
}

/* ===== ИНДИКАТОРЫ И ПРОГРЕСС-БАРЫ ===== */

/* Круговой индикатор */
.circle-indicator {
    width: 100px;
    height: 100px;
    position: relative;
    margin: 0 auto;
}

.circle-bg {
    fill: none;
    stroke: var(--bg-lighter);
    stroke-width: 8;
}

.circle-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.5s ease;
}

.circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.circle-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Линейный прогресс-бар */
.progress-bar {
    height: 20px;
    background: var(--bg-lighter);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

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

/* ===== ФОРМЫ И ВВОД ДАННЫХ ===== */

/* Поля ввода для планшета */
.input-field {
    width: 100%;
    padding: 15px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.1em;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.3);
}

.input-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
}

/* Выпадающие списки */
.select-dropdown {
    width: 100%;
    padding: 15px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.1em;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ff6b00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    padding-right: 50px;
}

/* Переключатели для планшета */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 70px;
    height: 34px;
}

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

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

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--text-primary);
    border-radius: 50%;
    transition: .4s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
    border-color: #ff944d;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(34px);
}

.toggle-label {
    margin-left: 15px;
    font-size: 1em;
    color: var(--text-primary);
    vertical-align: super;
}

/* ===== СПИСКИ И ТАБЛИЦЫ ===== */

/* Список станций */
.station-list {
    max-height: 400px;
    overflow-y: auto;
}

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

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

.station-item.active {
    background: var(--bg-lighter);
    border-left-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.2);
}

.station-name {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--text-primary);
}

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

.station-eta {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1em;
}

/* Таблица параметров */
.params-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.params-table th,
.params-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.params-table th {
    background: var(--bg-lighter);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
}

.params-table tr:hover {
    background: var(--bg-lighter);
}

.params-table .value-cell {
    font-weight: 700;
    text-align: right;
    font-family: var(--font-condensed);
}

.params-table .status-cell {
    text-align: center;
}

/* ===== УВЕДОМЛЕНИЯ И АЛЕРТЫ ===== */

/* Системные уведомления */
.notification-container {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 400px;
    z-index: 9999;
}

.notification {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-darker));
    border-left: 6px solid var(--warning-color);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.notification.info {
    border-left-color: var(--secondary-color);
}

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

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

.notification.danger {
    border-left-color: var(--danger-color);
    animation: pulse-alert 1s infinite;
}

.notification-icon {
    font-size: 1.8em;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.notification-message {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    flex-shrink: 0;
}

.notification-close:hover {
    color: var(--text-primary);
}

/* Критический алерт */
.critical-alert {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: emergencyFlash 1s infinite;
}

.critical-alert-content {
    text-align: center;
    color: white;
    padding: 40px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    max-width: 600px;
}

.critical-alert-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: shake 0.5s infinite;
}

.critical-alert-title {
    font-size: 2.5em;
    font-weight: 900;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.critical-alert-message {
    font-size: 1.3em;
    margin-bottom: 30px;
    line-height: 1.5;
}

/* ===== АНИМАЦИИ ===== */

@keyframes pulse-alert {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes emergencyFlash {
    0%, 100% {
        background-color: rgba(255, 0, 0, 0.9);
    }
    50% {
        background-color: rgba(255, 100, 100, 0.9);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

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

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

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

/* ===== МЕДИА ЗАПРОСЫ ДЛЯ ПЛАНШЕТА ===== */

@media (max-width: 1024px) {
    .cab-button {
        min-height: 70px;
        min-width: 100px;
        font-size: 1em;
        padding: 12px;
    }
    
    .button-icon {
        font-size: 1.6em;
    }
    
    .info-card {
        padding: 15px;
    }
    
    .info-card-value {
        font-size: 1.6em;
    }
    
    .circle-indicator {
        width: 80px;
        height: 80px;
    }
    
    .notification-container {
        width: 320px;
        top: 80px;
    }
}

@media (max-width: 768px) {
    .status-panel {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cab-button {
        min-height: 60px;
        min-width: 80px;
        font-size: 0.9em;
    }
    
    .params-table {
        font-size: 0.9em;
    }
    
    .params-table th,
    .params-table td {
        padding: 8px 10px;
    }
}

@media (orientation: portrait) {
    .cab-button {
        min-width: calc(50% - 20px);
    }
    
    .info-card {
        margin: 5px;
    }
}

/* ===== СПЕЦИАЛЬНЫЕ КОМПОНЕНТЫ ДЛЯ ЛОКОМОТИВА ===== */

/* Индикатор скорости */
.speedometer {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.speedometer-bg {
    fill: none;
    stroke: var(--bg-lighter);
    stroke-width: 10;
}

.speedometer-scale {
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 2;
    stroke-dasharray: 2, 10;
}

.speedometer-needle {
    fill: var(--danger-color);
    transform-origin: 100px 100px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.speedometer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.speedometer-value {
    font-size: 2.5em;
    font-weight: 900;
    color: var(--text-primary);
    font-family: var(--font-condensed);
}

.speedometer-unit {
    font-size: 1em;
    color: var(--text-secondary);
    margin-top: -10px;
}

/* Индикатор давления в тормозах */
.brake-pressure {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.brake-pressure-gauge {
    width: 150px;
    height: 150px;
    position: relative;
}

.brake-pressure-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: 900;
    color: var(--text-primary);
}

.brake-pressure-label {
    margin-top: 10px;
    font-size: 0.9em;
    color: var(--text-secondary);
    text-align: center;
}

/* Дисплей текущих параметров */
.params-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.param-box {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-darker));
    border-radius: var(--border-radius);
    padding: 15px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.param-box.critical {
    border-color: var(--danger-color);
    background: linear-gradient(135deg, #4a1a1a, var(--bg-darker));
    animation: pulse-alert 1s infinite;
}

.param-box.warning {
    border-color: var(--warning-color);
}

.param-box.good {
    border-color: var(--success-color);
}

.param-name {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.param-value {
    font-size: 1.8em;
    font-weight: 900;
    color: var(--text-primary);
    font-family: var(--font-condensed);
}

.param-unit {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* Панель голосового управления */
.voice-control {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 26, 42, 0.95);
    border-radius: 50px;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    border: 2px solid var(--primary-color);
}

.voice-icon {
    font-size: 2em;
    animation: pulse 2s infinite;
}

.voice-status {
    font-size: 1.1em;
    color: var(--text-primary);
    font-weight: 500;
}

.voice-listening .voice-icon {
    animation: pulse 0.5s infinite;
    color: var(--primary-color);
}

/* Таймер и обратный отсчет */
.countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-darker));
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

.countdown-digit {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 10px;
    font-size: 2.5em;
    font-weight: 900;
    color: var(--text-primary);
    min-width: 60px;
    text-align: center;
    font-family: var(--font-condensed);
}

.countdown-separator {
    font-size: 2em;
    color: var(--primary-color);
    font-weight: 700;
}

.countdown-label {
    font-size: 1em;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 5px;
}

/* Адаптация для высокой яркости (солнечный свет) */
.sunlight-mode {
    --text-primary: #000000;
    --text-secondary: #333333;
    --bg-dark: #ffffff;
    --bg-darker: #f0f0f0;
    --bg-light: #e8e8e8;
    --bg-lighter: #d8d8d8;
    --border-color: #cccccc;
    
    filter: contrast(1.3) brightness(1.2);
}

.sunlight-mode .cab-button {
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

.sunlight-mode .info-card {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Анимация загрузки */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 8px solid var(--bg-lighter);
    border-top: 8px solid var(--primary-color);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.loading-text {
    margin-top: 20px;
    font-size: 1.2em;
    color: var(--text-secondary);
    font-weight: 500;
}