:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --light-bg: #f5f6fa;
    --card-bg: #ffffff;
    --header-bg: #2c3e50;
    --footer-bg: #2c3e50;
}

[data-theme="dark"] {
    --primary-color: #1a1a1a;
    --secondary-color: #2980b9;
    --text-color: #ffffff;
    --light-bg: #121212;
    --card-bg: #1e1e1e;
    --header-bg: #1a1a1a;
    --footer-bg: #1a1a1a;
}

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

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--light-bg);
    transition: background-color 0.3s ease;
}

header {
    background: var(--header-bg);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--secondary-color);
}

.user-info {
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 2px solid white;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.logout-btn:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-1px);
}

main {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 20px;
}

main h1 {
    font-size: 1.8em;
    margin-bottom: 1rem;
    color: var(--text-color);
    text-align: center;
    font-weight: 600;
}

.content {
    margin-top: 1rem;
}

.content p {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.1em;
    opacity: 0.8;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.camera-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.camera-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.camera-container h4 {
    margin: 0 0 15px 0;
    color: var(--text-color);
    font-size: 1.2em;
    text-align: center;
}

.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    border-radius: 5px;
    overflow: hidden;
    background: #000;
}

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

.video-container button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    z-index: 2;
    transition: background 0.3s ease;
}

.video-container button:hover {
    background: rgba(0, 0, 0, 0.9);
}

.camera-card .btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #1a5276;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
    border: 2px solid #1a5276;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin-top: 1rem;
    width: 100%;
}

.camera-card .btn:hover {
    background: #2980b9;
    border-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

footer {
    background: var(--footer-bg);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.admin-link {
    color: #e74c3c;
    font-weight: 500;
    border: 1px solid #e74c3c;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.admin-link:hover {
    background: #e74c3c;
    color: white;
}

/* Switch styles */
.ui-switch {
    --switch-bg: rgb(135, 150, 165);
    --switch-width: 48px;
    --switch-height: 20px;
    --circle-diameter: 32px;
    --circle-bg: rgb(0, 56, 146);
    --circle-inset: calc((var(--circle-diameter) - var(--switch-height)) / 2);
    margin-left: 20px;
}

.ui-switch input {
    display: none;
}

.slider {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: var(--switch-width);
    height: var(--switch-height);
    background: var(--switch-bg);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
}

.slider .circle {
    top: calc(var(--circle-inset) * -1);
    left: 0;
    width: var(--circle-diameter);
    height: var(--circle-diameter);
    position: absolute;
    background: var(--circle-bg);
    border-radius: inherit;
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj4KICAgIDxwYXRoIGZpbGw9IiNmZmYiCiAgICAgICAgZD0iTTkuMzA1IDEuNjY3VjMuNzVoMS4zODlWMS42NjdoLTEuMzl6bS00LjcwNyAxLjk1bC0uOTgyLjk4Mkw5LjA5IDYuMDcybC45ODItLjk4Mi0xLjQ3My0xLjQ3M3ptMTAuODAyIDBMMTMuOTI3IDUuMDlsLjk4Mi45ODIgMS40NzMtMS40NzMtLjk4Mi0uOTgyek0xMCA1LjEzOWE0Ljg3MiA0Ljg3MiAwIDAwLTQuODYyIDQuODZBNC44NzIgNC44NzIgMCAwMTEwIDE0Ljg2MiA0Ljg3MiA0Ljg3MiAwIDAwMTQuODYgMTAgNC44NzIgNC44NzIgMCAwMTEwIDUuMTM5em0wIDEuMzg5QTMuNDYyIDMuNDYyIDAgMDExMy40NzEgMTBhMy40NjIgMy40NjIgMCAwMS0zLjQ3MyAzLjQ3MkEzLjQ2MiAzLjQ2MiAwIDAxNi41MjcgMTAgMy40NjIgMy40NjIgMCAwMTEwIDYuNTI4ek0xLjY2NSA5LjMwNXYxLjM5aDIuMDgzdi0xLjM5SDEuNjY2em0xNC41ODMgMHYxLjM5aDIuMDg0di0xLjM5aC0yLjA4NHpNNS4wOSAxMy45MjhMMy42MTYgMTUuNGwuOTgyLjk4MiAxLjQ3My0xLjQ3My0uOTgyLS45ODJ6bTkuODIgMGwtLjk4Mi45ODIgMS40NzMgMS40NzMuOTgyLS45ODItMS40NzMtMS40NzN6TTkuMzA1IDE2LjI1djIuMDgzaDEuMzg5VjE2LjI1aC0xLjM5eiIgLz4KPC9zdmc+");
    background-repeat: no-repeat;
    background-position: center center;
    transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12);
}

.slider .circle::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.75);
    border-radius: inherit;
    transition: all 500ms;
    opacity: 0;
}

.ui-switch input:checked + .slider .circle {
    left: calc(100% - var(--circle-diameter));
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj4KICAgIDxwYXRoIGZpbGw9IiNmZmYiCiAgICAgICAgZD0iTTQuMiAyLjVsLS43IDEuOC0xLjguNyAxLjguNy43IDEuOC42LTEuOEw2LjcgNWwtMS45LS43LS42LTEuOHptMTUgOC4zYTYuNyA2LjcgMCAxMS02LjYtNi42IDUuOCA1LjggMCAwMDYuNiA2LjZ6IiAvPgo8L3N2Zz4=");
}

.ui-switch input:active + .slider .circle::before {
    transition: 0s;
    opacity: 1;
    width: 0;
    height: 0;
}

@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

.camera-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.camera-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: auto;
    max-height: 400px;
}

.camera-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.camera-card h3 {
    padding: 12px 15px;
    margin: 0;
    color: var(--text-color);
    font-size: 1.1em;
    text-align: center;
    font-weight: 600;
    background: rgba(52, 152, 219, 0.05);
    border-bottom: 1px solid rgba(52, 152, 219, 0.1);
}

.camera-card .video-container {
    width: 100%;
    height: 160px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.camera-card .video-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.camera-card:hover .video-container img {
    transform: scale(1.05);
}

.camera-card .btn {
    margin: 12px 15px 15px 15px;
    padding: 10px 15px;
    background: var(--primary-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: calc(100% - 30px);
    box-sizing: border-box;
    font-weight: 500;
    font-size: 0.95em;
    border: none;
    cursor: pointer;
}

.camera-card .btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

@media (max-width: 768px) {
    .camera-grid {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 20px;
    }
    
    .camera-grid.single-location {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
    
    .camera-card {
        max-height: none;
    }
    
    .camera-card .video-container {
        height: 140px;
    }
    
    main {
        margin: 1rem auto;
        padding: 0 15px;
    }
    
    main h1 {
        font-size: 1.5em;
    }
    
    .content p {
        font-size: 1em;
    }
}

/* Стили для блока "Нет локаций" */
.no-locations {
    text-align: center;
    padding: 40px 20px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
    max-width: 600px;
}

.no-locations p {
    margin-bottom: 20px;
    font-size: 1.1em;
    color: var(--text-color);
}

.admin-actions {
    margin-top: 30px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

.btn-primary {
    background: var(--primary-color) !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    border: none !important;
    cursor: pointer !important;
}

.btn-primary:hover {
    background: var(--secondary-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.btn-secondary {
    background: #95a5a6 !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    border: none !important;
    cursor: pointer !important;
}

.btn-secondary:hover {
    background: #7f8c8d !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.admin-note {
    background: #e8f5e8;
    color: #2d5a2d;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
    margin-top: 20px;
    font-size: 0.9em;
}

.user-note {
    background: #fff3cd;
    color: #856404;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
    margin-top: 20px;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }
} 

/* Специальные стили для одной локации */
.camera-grid:has(.camera-card:only-child) {
    grid-template-columns: minmax(280px, 500px);
    justify-content: center;
}

.camera-grid:has(.camera-card:only-child) .camera-card {
    max-width: 500px;
    margin: 0 auto;
}

/* Альтернативный способ для браузеров без поддержки :has() */
.camera-grid.single-location {
    grid-template-columns: minmax(280px, 500px);
    justify-content: center;
}

.camera-grid.single-location .camera-card {
    max-width: 500px;
    margin: 0 auto;
} 

/* Стили для разных типов отображения */

/* Только текст */
.camera-grid.view-text_only .camera-card,
.view-text_only .camera-card {
    max-height: none;
    padding: 1rem;
}

.view-text_only .camera-card h3 {
    font-size: 1.3em;
    margin-bottom: 0.5rem;
}

.view-text_only .camera-card .btn {
    margin: 0.5rem 0 0 0;
    padding: 8px 16px;
    font-size: 0.9em;
}

/* Маленькие карточки */
.view-small_cards .camera-grid,
.camera-grid.view-small_cards {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.camera-grid.view-small_cards .camera-card,
.view-small_cards .camera-card {
    /* Не ограничиваем высоту, чтобы кнопка и изображение всегда влезали */
    max-height: none;
}

.camera-grid.view-small_cards .camera-card h3,
.view-small_cards .camera-card h3 {
    padding: 6px 10px;
    font-size: 0.95em;
}

.camera-grid.view-small_cards .camera-card .video-container,
.view-small_cards .camera-card .video-container {
    height: 110px;
}

.camera-grid.view-small_cards .camera-card .btn,
.view-small_cards .camera-card .btn {
    margin: 6px 10px 10px 10px;
    padding: 6px 10px;
    font-size: 0.85em;
    width: calc(100% - 20px);
}

/* Большие карточки (по умолчанию) */
.view-large_cards .camera-card,
.camera-grid.view-large_cards .camera-card {
    /* Не ограничиваем жёстко, чтобы кнопка не обрезалась на разных шрифтах/скейлах */
    max-height: none;
}

.view-large_cards .camera-card .video-container,
.camera-grid.view-large_cards .camera-card .video-container {
    height: 220px;
}

/* Кнопка на больших карточках иногда выглядела «съехавшей» из‑за конкурирующих правил */
.view-large_cards .camera-card .btn {
    width: calc(100% - 30px);
    margin: 12px 15px 15px 15px;
    font-size: 1em;
}

/* Адаптивность для разных типов отображения */
@media (max-width: 768px) {
    .view-text_only .camera-card {
        padding: 0.8rem;
    }
    
    .view-text_only .camera-card h3 {
        font-size: 1.2em;
    }
    
    .view-small_cards .camera-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .view-small_cards .camera-card {
        max-height: none;
    }
    
    .view-small_cards .camera-card .video-container {
        height: 100px;
    }
    
    .view-large_cards .camera-card .video-container {
        height: 140px;
    }
} 