:root {
    --primary: #1a73e8;
    --primary-dark: #0d47a1;
    --secondary: #00c853;
    --accent: #ff4081;
    --dark: #121212;
    --dark-surface: #1e1e1e;
    --dark-card: #2d2d2d;
    --light: #f5f5f5;
    --light-surface: #ffffff;
    --light-card: #f9f9f9;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-radius: 12px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

.dark-mode {
    --primary: #4285f4;
    --primary-dark: #3367d6;
    --secondary: #00c853;
    --accent: #ff4081;
    --dark: #121212;
    --dark-surface: #1e1e1e;
    --dark-card: #2d2d2d;
    --light: #f5f5f5;
    --light-surface: #252525;
    --light-card: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #aaaaaa;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--light-surface);
    color: var(--text-primary);
    transition: var(--transition);
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER STYLES - LOGO PERBAIKAN */
header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.8rem 2rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: var(--transition);
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo {
    height: 35px; /* Diperkecil dari 50px */
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    height: 100%;
    width: auto;
    max-height: 35px; /* Diperkecil dari 50px */
    object-fit: contain;
    border-radius: 6px;
}

.logo-text h1 {
    font-size: 1.3rem; /* Diperkecil sedikit */
    font-weight: 700;
    color: white;
    margin: 0;
}

.logo-text p {
    font-size: 0.8rem; /* Diperkecil sedikit */
    opacity: 0.9;
    color: white;
    margin: 0;
}

/* Untuk mobile - logo lebih kecil lagi */
@media (max-width: 768px) {
    header {
        padding: 0.6rem 1rem;
    }
    
    .logo {
        height: 30px;
    }
    
    .logo-img {
        max-height: 30px;
    }
    
    .logo-text h1 {
        font-size: 1.1rem;
    }
    
    .logo-text p {
        font-size: 0.7rem;
    }
    
    .logo-section {
        gap: 0.6rem;
    }
}

@media (max-width: 480px) {
    .logo {
        height: 28px;
    }
    
    .logo-img {
        max-height: 28px;
    }
    
    .logo-text h1 {
        font-size: 1rem;
    }
}

.theme-toggle, .menu-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover, .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.menu-toggle {
    display: none;
}

/* MAIN CONTAINER */
.main-container {
    display: flex;
    max-width: 1400px;
    margin: 2rem auto;
    gap: 2rem;
    padding: 0 1rem;
    flex: 1;
    width: 100%;
}

/* SIDEBAR STYLES */
.sidebar {
    flex: 0 0 300px;
    background: var(--light-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    height: fit-content;
    transition: var(--transition);
}

.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 50px;
    border: 1px solid #ddd;
    background: var(--light-surface);
    color: var(--text-primary);
    transition: var(--transition);
    font-size: 16px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.camera-list {
    max-height: 500px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.camera-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    background: var(--light-surface);
    position: relative;
    border-left: 4px solid transparent;
    -webkit-tap-highlight-color: transparent;
}

.camera-item:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.camera-item.online {
    border-left-color: var(--secondary);
}

.camera-item.offline {
    border-left-color: #f44336;
    opacity: 0.7;
    background: rgba(244, 67, 54, 0.05);
}

.camera-item.checking {
    border-left-color: #ff9800;
    opacity: 0.8;
}

.camera-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    transition: var(--transition);
}

.camera-item.offline .camera-icon {
    background: #f44336;
}

.camera-item.checking .camera-icon {
    background: #ff9800;
}

.camera-info {
    flex: 1;
    min-width: 0;
}

.camera-info h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.camera-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-wrap: break-word;
}

.camera-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}

.camera-ip {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.camera-status {
    margin-left: auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--secondary);
    flex-shrink: 0;
    transition: var(--transition);
}

.camera-status.offline {
    background: #f44336;
}

.camera-status.checking {
    background: #ff9800;
    animation: pulse 1.5s infinite;
}

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

.status-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    color: white;
}

.offline-badge {
    background: #f44336;
}

.checking-badge {
    background: #ff9800;
}

/* MAP CONTAINER */
.map-container {
    flex: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    height: 600px;
    min-height: 400px;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Leaflet map fixes */
.leaflet-container {
    background: var(--light-card);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-x pan-y;
}

.leaflet-popup-content {
    margin: 13px 19px;
    line-height: 1.4;
    font-size: 14px;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius);
    background: var(--light-card);
    color: var(--text-primary);
    box-shadow: var(--shadow);
}

.leaflet-popup-tip {
    background: var(--light-card);
}

.leaflet-control-zoom a {
    background: var(--light-card) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--text-secondary) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--primary) !important;
    color: white !important;
}

/* STATS CONTAINER */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 0 1rem;
}

.stat-card {
    background: var(--light-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.stat-card:nth-child(1) .stat-icon {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
}

.stat-card:nth-child(2) .stat-icon {
    background: rgba(0, 200, 83, 0.1);
    color: var(--secondary);
}

.stat-card:nth-child(3) .stat-icon {
    background: rgba(255, 64, 129, 0.1);
    color: var(--accent);
}

.stat-card:nth-child(4) .stat-icon {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* FOOTER */
/* FOOTER STYLES - LOGO KECIL */
footer {
    background: var(--dark);
    color: white;
    padding: 1.5rem 2rem;
    margin-top: 3rem;
    flex-shrink: 0;
}

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

.footer-logo-img {
    height: 20px; /* Extra kecil */
    width: auto;
    object-fit: contain;
    border-radius: 3px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem; /* Gap lebih kecil */
}

.footer-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: var(--transition);
}

.footer-logo-link:hover {
    transform: scale(1.05);
}


.footer-text {
    display: flex;
    flex-direction: column;
}

.footer-link {
    text-decoration: none;
    color: white;
    transition: var(--transition);
}

.footer-link:hover {
    color: #aaa;
}

.footer-text h3 {
    font-size: 1rem; /* Diperkecil sedikit */
    margin: 0 0 0.2rem 0;
    font-weight: 600;
}

.footer-text p {
    font-size: 0.75rem; /* Diperkecil */
    color: #aaa;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: #aaa;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: white;
}

/* Mobile Responsive untuk Footer */
@media (max-width: 768px) {
    .footer-logo-img {
        height: 18px;
    }
    
    .footer-logo {
        flex-direction: row; /* Tetap sejajar di mobile */
        gap: 0.6rem;
    }
    
    .footer-logo-img {
        height: 22px; /* Lebih kecil di mobile */
    }
    
    .footer-text h3 {
        font-size: 0.9rem;
    }
    
    .footer-text p {
        font-size: 0.7rem;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .footer-links a {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    footer {
        padding: 1.2rem 1rem;
    }
    
    .footer-logo {
        gap: 0.5rem;
    }
    
    .footer-logo-img {
        height: 20px; /* Sangat kecil di mobile kecil */
    }
    
    .footer-text h3 {
        font-size: 0.85rem;
    }
    
    .footer-text p {
        font-size: 0.65rem;
    }
    
    .footer-links {
        gap: 0.8rem;
    }
    
    .footer-links a {
        font-size: 0.75rem;
    }
}

/* ==================== */
/* VIDEO PLAYER STYLES */
/* ==================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--light-card);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#player {
    width: 100%;
    height: 500px;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Video.js Styles */
.video-js {
    width: 100% !important;
    height: 100% !important;
    background: #000 !important;
}

.vjs-fluid {
    padding-top: 0 !important;
}

.video-js .vjs-tech {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.video-js .vjs-big-play-button {
    font-size: 3em !important;
    line-height: 1.5em !important;
    height: 1.5em !important;
    width: 3em !important;
    border-radius: 0.75em !important;
    border: none !important;
    background-color: rgba(26, 115, 232, 0.9) !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    transition: all 0.3s ease !important;
}

.video-js .vjs-control-bar {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 100%) !important;
    height: 3.5em !important;
}

.video-js .vjs-play-progress,
.video-js .vjs-volume-level {
    background-color: var(--primary) !important;
}

/* Loading and Error States */
.loading-indicator {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    background: var(--light-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex: 1;
}

.loading-indicator i {
    font-size: 2rem;
    color: var(--primary);
}

.error-message {
    text-align: center;
    padding: 3rem 2rem;
    color: #f44336;
    background: rgba(244, 67, 54, 0.05);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex: 1;
}

.error-message i {
    font-size: 2rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== */
/* RESPONSIVE DESIGN */
/* ==================== */

@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        flex: 1;
        width: 100%;
        max-width: 100%;
    }
    
    .map-container {
        height: 500px;
    }
    
    .modal-content {
        max-width: 95%;
    }
    
    #player {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        padding: 0 1rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 999;
        background: var(--light-card);
        border-radius: 0;
        overflow-y: auto;
    }
    
    .sidebar.active {
        display: block;
    }
    
    .map-container {
        height: 400px;
        min-height: 300px;
    }
    
    .footer-container {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .modal {
        padding: 0.5rem;
    }
    
    .modal-content {
        max-height: 95vh;
        max-width: 98%;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    #player {
        height: 300px;
    }
    
    .video-js .vjs-control-bar {
        height: 3em !important;
        font-size: 12px !important;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1rem;
    }
    
    .logo-text h1 {
        font-size: 1.2rem;
    }
    
    .logo-text p {
        font-size: 0.8rem;
    }
    
    .main-container {
        margin: 1rem auto;
        gap: 1rem;
        padding: 0 0.5rem;
    }
    
    .map-container {
        height: 350px;
        min-height: 250px;
        border-radius: 8px;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
    }
    
    .close-modal {
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
    
    #player {
        height: 250px;
    }
    
    .camera-item {
        padding: 0.75rem;
    }
    
    .camera-info h3 {
        font-size: 0.9rem;
    }
    
    .camera-info p {
        font-size: 0.75rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.dark-mode ::-webkit-scrollbar-track {
    background: #333;
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
}