/**
 * Camera Player Styles
 * Style dla odtwarzacza kamer z pełną responsywnością
 */

/* Kontener pojedynczej kamery */
.camera-stream-container {
    margin: 20px 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Nagłówek kamery */
.camera-header {
    background: #1a1a1a;
    padding: 12px 20px;
    border-bottom: 2px solid #333;
}

.camera-title {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

/* Wrapper dla video */
.camera-player-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    overflow: hidden;
}

/* Video element */
.camera-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Ukryj domyślne kontrolki przeglądarki */
.camera-video::-webkit-media-controls {
    display: none !important;
}

.camera-video::-webkit-media-controls-enclosure {
    display: none !important;
}

.camera-video::-webkit-media-controls-panel {
    display: none !important;
}

.camera-video::--webkit-media-controls-play-button {
    display: none !important;
}

/* Animacja ładowania */
.camera-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 16px;
    z-index: 10;
}

.camera-loading::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    margin-top: 50px;
    border: 4px solid #333;
    border-top-color: #fff;
    border-radius: 50%;
    animation: camera-spin 1s linear infinite;
}

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

/* Komunikat błędu */
.camera-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    color: #ff6b6b;
    font-size: 16px;
    text-align: center;
    padding: 20px;
    z-index: 11;
}

/* Kontrolki */
.camera-controls {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: #1a1a1a;
    border-top: 1px solid #333;
}

/* Przyciski */
.camera-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.camera-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.camera-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.camera-btn:focus {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.camera-fullscreen {
    background: #059669;
}

.camera-fullscreen:hover {
    background: #047857;
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

/* Ikony w przyciskach */
.play-icon,
.pause-icon,
.fullscreen-icon {
    font-size: 18px;
    line-height: 1;
}

/* Grid dla wszystkich kamer */
.all-cameras-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.all-cameras-grid[data-columns="1"] {
    grid-template-columns: 1fr;
}

.all-cameras-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.all-cameras-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.all-cameras-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Pełny ekran */
.camera-player-wrapper:-webkit-full-screen {
    padding-bottom: 0 !important;
}

.camera-player-wrapper:-moz-full-screen {
    padding-bottom: 0 !important;
}

.camera-player-wrapper:fullscreen {
    padding-bottom: 0 !important;
}

.camera-player-wrapper:-webkit-full-screen .camera-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-player-wrapper:-moz-full-screen .camera-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-player-wrapper:fullscreen .camera-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .all-cameras-grid[data-columns="2"],
    .all-cameras-grid[data-columns="3"],
    .all-cameras-grid[data-columns="4"] {
        grid-template-columns: 1fr;
    }
    
    .camera-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .camera-btn {
        width: 100%;
    }
    
    .camera-title {
        font-size: 14px;
    }
    
    .camera-header {
        padding: 10px 15px;
    }
    
    .camera-controls {
        padding: 12px 15px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .all-cameras-grid[data-columns="3"],
    .all-cameras-grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animacje dla lepszego UX */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.camera-stream-container {
    animation: fadeIn 0.3s ease-in;
}

/* Safari specific fixes */
@supports (-webkit-appearance: none) {
    .camera-video {
        -webkit-appearance: none;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .camera-player-wrapper {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .camera-video {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .camera-stream-container {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
}

/* Print styles - ukryj odtwarzacze przy drukowaniu */
@media print {
    .camera-stream-container {
        display: none;
    }
}

/* Accessibility - fokus dla użytkowników klawiatury */
.camera-btn:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 3px;
}

/* Wysoki kontrast dla dostępności */
@media (prefers-contrast: high) {
    .camera-btn {
        border: 2px solid #fff;
    }
    
    .camera-header {
        border-bottom: 3px solid #fff;
    }
}

/* Redukcja animacji dla użytkowników z preferencją */
@media (prefers-reduced-motion: reduce) {
    .camera-loading::after {
        animation: none;
    }
    
    .camera-stream-container {
        animation: none;
    }
    
    .camera-btn {
        transition: none;
    }
}
