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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #18181b;
    --text-secondary: #71717a;
    --border-color: #e4e4e7;
    --accent-color: #3b82f6;
    --hover-bg: #f4f4f5;
}

.dark {
    --bg-primary: #09090b;
    --bg-secondary: #18181b;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --border-color: #27272a;
    --accent-color: #60a5fa;
    --hover-bg: #27272a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    display: grid;
    grid-template-columns: 256px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

/* Header */
.header {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

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

.header h1 {
    font-size: 1.5rem;
}

.header h1 a {
    color: var(--text-primary);
    text-decoration: none;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.map-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.875rem;
}

.map-link:hover {
    color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--hover-bg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

.dark .theme-toggle .sun-icon {
    display: block;
}

.dark .theme-toggle .moon-icon {
    display: none;
}

/* Sidebar */
.sidebar {
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
}


.categories {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    text-align: left;
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9375rem;
}

.category-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.category-btn.active {
    background: var(--hover-bg);
    color: var(--text-primary);
    font-weight: 600;
}

.category-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.search-container {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.camera-count {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Camera Grid */
.camera-grid {
    display: grid;
    gap: 0.75rem;
}

/* Responsive grid columns */
@media (min-width: 640px) {
    .camera-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .camera-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .camera-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* For mobile, default is 1 column (no media query needed) */
@media (max-width: 639px) {
    .camera-grid {
        grid-template-columns: 1fr;
    }
}

.camera-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.camera-card:hover {
    border-color: var(--accent-color);
}

.camera-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.camera-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

.resolution-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s;
}

.camera-thumbnail:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    width: 64px;
    height: 64px;
    fill: white;
}

.camera-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.camera-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.camera-location {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.camera-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: 1px solid var(--accent-color);
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 256px;
        background: var(--bg-primary);
        z-index: 999;
        border-right: 1px solid var(--border-color);
    }

    .sidebar.active {
        display: block;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .camera-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .camera-grid {
        grid-template-columns: 1fr;
    }
}

/* Footer */
.footer {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1536px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-copyright {
    max-width: 48rem;
}

.footer-copyright p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.footer-disclaimer {
    font-size: 0.75rem !important;
    color: var(--text-secondary) !important;
}

/* Cookie Consent */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 2px solid var(--accent-color);
    padding: 1.5rem;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.cookie-content p {
    flex: 1;
    margin: 0;
    color: var(--text-primary);
}

.cookie-actions {
    display: flex;
    gap: 1rem;
}

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cookie-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .cookie-actions .btn {
        width: 100%;
    }
}
