/* Основные стили для веб-приложения камер */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a3a3f 0%, #0d1f23 50%, #1a2d35 100%);
    min-height: 100vh;
    color: #e0f2f0;
    position: relative;
}

/* Эффект северного сияния на фоне */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at top, rgba(16, 185, 129, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 20%, rgba(94, 234, 212, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

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

header {
    text-align: center;
    color: #e0f2f0;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(26, 58, 63, 0.6);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(94, 234, 212, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 
        0 0 10px rgba(94, 234, 212, 0.5),
        0 0 20px rgba(16, 185, 129, 0.3),
        2px 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #5eead4 0%, #10b981 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    color: #94a3b8;
}

.main-content {
    display: block;
    margin-top: 20px;
}

/* Список камер */
.cameras-list {
    background: rgba(26, 58, 63, 0.7);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    border: 1px solid rgba(94, 234, 212, 0.2);
    backdrop-filter: blur(10px);
}

.cameras-list h2 {
    margin-bottom: 15px;
    color: #5eead4;
    font-size: 1.5em;
    text-shadow: 0 0 10px rgba(94, 234, 212, 0.5);
}

#cameras-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.camera-item {
    padding: 15px;
    border: 2px solid rgba(94, 234, 212, 0.3);
    border-radius: 10px;
    transition: all 0.3s ease;
    background: rgba(26, 45, 53, 0.6);
    color: #e0f2f0;
}

.camera-item.available:hover {
    border-color: #5eead4;
    background: rgba(94, 234, 212, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(94, 234, 212, 0.3);
}

.camera-item.selected {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

.camera-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.camera-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #e0f2f0;
}

.camera-status {
    font-size: 0.85em;
    padding: 4px 8px;
    border-radius: 5px;
    font-weight: bold;
}

.camera-status.live {
    background: rgba(16, 185, 129, 0.2);
    color: #5eead4;
    border: 1px solid rgba(94, 234, 212, 0.4);
}

.camera-status.offline {
    background: rgba(26, 45, 53, 0.5);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.camera-address {
    font-size: 0.9em;
    color: #94a3b8;
    margin-top: 5px;
}

.camera-unavailable {
    font-size: 0.85em;
    color: #94a3b8;
    font-style: italic;
    margin-top: 5px;
}

.camera-loading {
    font-size: 0.85em;
    color: #5eead4;
    font-style: italic;
    margin-top: 5px;
}

.camera-preview-error {
    font-size: 0.85em;
    color: #f87171;
    font-style: italic;
    margin-top: 5px;
    font-weight: bold;
}

.camera-preview-info {
    font-size: 0.85em;
    color: #5eead4;
    font-style: italic;
    margin-top: 5px;
}

.loading, .error {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
}

.error {
    color: #f87171;
}

/* Основная панель */
.main-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.map-container {
    background: rgba(26, 58, 63, 0.7);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    border: 1px solid rgba(94, 234, 212, 0.2);
    backdrop-filter: blur(10px);
}

#map {
    border-radius: 10px;
    overflow: hidden;
}

/* Сетка превью камер */
.cameras-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.camera-preview {
    background: rgba(26, 58, 63, 0.7);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(94, 234, 212, 0.2);
    backdrop-filter: blur(10px);
}

.camera-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(94, 234, 212, 0.4);
    border: 2px solid #5eead4;
    background: rgba(26, 58, 63, 0.9);
}

.camera-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.camera-preview-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #e0f2f0;
}

.camera-preview-status {
    font-size: 0.85em;
    padding: 4px 8px;
    border-radius: 5px;
    font-weight: bold;
}

.camera-preview-status.live {
    background: rgba(16, 185, 129, 0.2);
    color: #5eead4;
    border: 1px solid rgba(94, 234, 212, 0.4);
}

.camera-preview-status.offline {
    background: rgba(26, 45, 53, 0.5);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.camera-preview-image {
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 10px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s;
}

.camera-preview-image .play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(94, 234, 212, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0.8;
    box-shadow: 0 0 20px rgba(94, 234, 212, 0.6);
}

.camera-preview-image:hover .play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.camera-preview-image .play-overlay::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 20px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 5px;
}

.camera-preview-address {
    font-size: 0.9em;
    color: #94a3b8;
    margin-top: 5px;
}

.camera-preview-loading {
    color: #5eead4;
    font-style: italic;
    font-size: 0.85em;
    margin-top: 5px;
}

/* Полноэкранный видеоплеер */
.fullscreen-player {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: #e0f2f0;
}

.fullscreen-header h3 {
    color: #5eead4;
    margin: 0;
    font-size: 1.5em;
    text-shadow: 0 0 10px rgba(94, 234, 212, 0.5);
}

.close-button {
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: #0d1f23;
    border: 1px solid rgba(94, 234, 212, 0.5);
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.close-button:hover {
    background: linear-gradient(135deg, #5eead4 0%, #10b981 100%);
    box-shadow: 0 6px 20px rgba(94, 234, 212, 0.5);
    transform: translateY(-2px);
}

#fullscreen-video-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    position: relative; /* Добавляем для позиционирования overlay */
}

#fullscreen-video-wrapper .video-js {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    position: relative; /* Для позиционирования overlay относительно video-js */
}

#fullscreen-camera-info {
    margin-top: 20px;
    color: #e0f2f0;
    text-align: center;
}

#fullscreen-camera-info p {
    margin: 5px 0;
    color: #94a3b8;
}

/* Стили для меток на карте */
.map-balloon {
    padding: 10px;
}

.map-balloon h4 {
    margin-bottom: 8px;
    color: #5eead4;
}

.map-balloon button {
    margin-top: 10px;
    padding: 8px 15px;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: #0d1f23;
    border: 1px solid rgba(94, 234, 212, 0.5);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.map-balloon button:hover {
    background: linear-gradient(135deg, #5eead4 0%, #10b981 100%);
    box-shadow: 0 6px 20px rgba(94, 234, 212, 0.5);
    transform: translateY(-2px);
}

/* Адаптивный дизайн */
@media (max-width: 1024px) {
    .main-content {
        /* Удалено, так как список камер убран */
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .cameras-list {
        max-height: 300px;
    }

    header h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .map-container {
        padding: 10px;
    }

    #map {
        height: 300px !important;
    }
}

/* Скроллбар для списка камер */
.cameras-list::-webkit-scrollbar {
    width: 8px;
}

.cameras-list::-webkit-scrollbar-track {
    background: rgba(26, 45, 53, 0.5);
    border-radius: 10px;
}

.cameras-list::-webkit-scrollbar-thumb {
    background: #5eead4;
    border-radius: 10px;
}

.cameras-list::-webkit-scrollbar-thumb:hover {
    background: #10b981;
}


/* Ссылка на местоположение в верхнем левом углу видео */
.video-location-link {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 100000 !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(26, 58, 63, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #e0f2f0;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(94, 234, 212, 0.3);
}

.video-location-link:hover {
    background: rgba(16, 185, 129, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(94, 234, 212, 0.4);
    color: #5eead4;
    text-decoration: none;
    border-color: rgba(94, 234, 212, 0.6);
}

.video-location-link:active {
    transform: translateY(0);
}

.video-location-link .location-icon {
    font-size: 16px;
    line-height: 1;
}

#video-location-name {
    white-space: nowrap;
}

/* Таймер сессии */
.session-timer {
    margin-top: 15px;
    padding: 10px 20px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(94, 234, 212, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1em;
}

.session-timer .timer-label {
    color: #94a3b8;
}

.session-timer .timer-display {
    font-weight: bold;
    color: #5eead4;
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
}

.session-timer.warning {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.5);
}

.session-timer.warning .timer-display {
    color: #fbbf24;
}

.session-timer.expired {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
}

.session-timer.expired .timer-display {
    color: #ef4444;
}

/* Блок оплаты */
.payment-block {
    background: rgba(26, 58, 63, 0.7);
    border-radius: 15px;
    padding: 30px;
    margin: 30px 0;
    text-align: center;
    border: 1px solid rgba(94, 234, 212, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.payment-block h3 {
    font-size: 2em;
    color: #5eead4;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(94, 234, 212, 0.5);
}

.payment-subtitle {
    font-size: 1.1em;
    color: #94a3b8;
    margin-bottom: 15px;
}

.payment-description {
    font-size: 1em;
    color: #cbd5e1;
    line-height: 1.7;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 10px;
    border-left: 3px solid rgba(94, 234, 212, 0.5);
}

.payment-button {
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: #0d1f23;
    border: 1px solid rgba(94, 234, 212, 0.5);
    padding: 15px 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    margin-bottom: 20px;
}

.payment-button:hover {
    background: linear-gradient(135deg, #5eead4 0%, #10b981 100%);
    box-shadow: 0 6px 20px rgba(94, 234, 212, 0.5);
    transform: translateY(-2px);
}

.payment-integration {
    margin-top: 20px;
    padding: 20px;
    background: rgba(26, 45, 53, 0.5);
    border-radius: 8px;
    border: 1px dashed rgba(94, 234, 212, 0.3);
    min-height: 100px;
}

.payment-placeholder {
    color: #94a3b8;
    font-style: italic;
}

/* Free camera player */
.free-camera-player {
    background: rgba(26, 58, 63, 0.7);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(94, 234, 212, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.free-camera-player h2 {
    color: #5eead4;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(94, 234, 212, 0.5);
}

.video-container {
    width: 100%;
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.video-container .video-js {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: rgba(26, 58, 63, 0.95);
    border-radius: 15px;
    padding: 30px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(94, 234, 212, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    color: #e0f2f0;
}

.modal-content h2 {
    color: #5eead4;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(94, 234, 212, 0.5);
}

.modal-content h3 {
    color: #5eead4;
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-content li {
    margin-bottom: 8px;
}

.modal-content a {
    color: #5eead4;
    text-decoration: underline;
}

.modal-content a:hover {
    color: #10b981;
}

/* Стили для контента из telegra.ph в модальном окне */
.modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #e0f2f0;
}

.modal-content h1,
.modal-content h2,
.modal-content h3,
.modal-content h4 {
    color: #5eead4;
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-content ul,
.modal-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-content li {
    margin-bottom: 8px;
    color: #e0f2f0;
}

.modal-content strong,
.modal-content b {
    color: #5eead4;
    font-weight: 600;
}

.modal-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #94a3b8;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(26, 45, 53, 0.5);
}

.modal-close:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.2);
}

/* Информационные ссылки */
.info-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
    padding: 20px;
    background: rgba(26, 58, 63, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(94, 234, 212, 0.2);
}

.info-link {
    color: #5eead4;
    text-decoration: none;
    font-size: 1em;
    padding: 8px 15px;
    border-radius: 5px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.info-link:hover {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(94, 234, 212, 0.3);
    transform: translateY(-2px);
}

/* Контактная информация */
.contact-info {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    margin-top: 20px;
}

.contact-info a {
    color: #5eead4;
    text-decoration: none;
}

.contact-info a:hover {
    color: #10b981;
    text-decoration: underline;
}

/* Адаптивность для модальных окон */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        padding: 20px;
        max-height: 95vh;
    }
    
    .payment-block {
        padding: 20px;
    }
    
    .payment-block h3 {
        font-size: 1.5em;
    }
    
    .info-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .video-container {
        padding-top: 75%; /* Более квадратный формат на мобильных */
    }
}

