@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-blue: #2563eb;
    --primary-blue-hover: #1d4ed8;
    --sidebar-bg: #ffffff;
    --bg-color: #f3f4f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --card-bg: #ffffff;
    --font-family: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
}

.sidebar-logo {
    padding: 24px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    padding: 24px 16px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-item:hover, .nav-item.active {
    background-color: #eff6ff;
    color: var(--primary-blue);
}

.nav-item i {
    margin-right: 12px;
    font-size: 18px;
}

.sidebar-footer {
    padding: 24px 16px;
    border-top: 1px solid var(--border-color);
}

.export-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.export-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar Styling */
.topbar {
    height: 72px;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
}

.greeting h1 {
    font-size: 24px;
    font-weight: 700;
}

.greeting p {
    font-size: 14px;
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.notification-btn {
    position: relative;
    background: white;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background-color: var(--danger-color);
    border-radius: 50%;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 8px 16px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: var(--primary-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info .name {
    font-weight: 600;
    font-size: 14px;
}

.user-info .role {
    font-size: 12px;
    color: var(--primary-blue);
}

/* Content Area */
.content-area {
    padding: 24px 32px;
    flex: 1;
}

/* Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.side-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Blue Status Card */
.status-card {
    background-color: var(--primary-blue);
    border-radius: 16px;
    padding: 24px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1), 0 2px 4px -1px rgba(37, 99, 235, 0.06);
    transition: transform 0.2s;
}

.status-card:hover {
    transform: translateY(-2px);
}

.status-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.status-card p {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 16px;
}

.online-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge {
    background-color: var(--success-color);
    padding: 8px 24px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 14px;
}

/* Section Titles */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.stat-card .label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-blue);
}

.stat-card .value.green { color: var(--success-color); }
.stat-card .value.red { color: var(--danger-color); }

.stat-card .trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 8px;
}
.stat-card .trend.up { color: var(--danger-color); }
.stat-card .trend.down { color: var(--success-color); }

/* Camera Cards */
.camera-card {
    background: #111827;
    border-radius: 16px;
    padding: 16px;
    color: white;
    height: 180px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 500;
}

.camera-icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #4b5563;
}

.recording-dot {
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
    position: absolute;
    top: 40px;
    left: 16px;
}

/* Chart Card */
.chart-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Sidebar Widgets */
.widget-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.location-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.location-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.location-icon {
    width: 32px;
    height: 32px;
    background: #fef08a;
    color: #ca8a04;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.location-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Map placeholder */
.map-container {
    height: 200px;
    background: #e5e7eb;
    border-radius: 12px;
    margin-top: 12px;
    overflow: hidden;
}

.node-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.node-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}
.node-badge.hulu { background: var(--success-color); }
.node-badge.hilir { background: var(--danger-color); }

/* Time Widget */
.time-widget {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
}
.time-widget span {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Login Page Styling */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    background-image: linear-gradient(135deg, #f3f4f6 0%, #e0e7ff 100%);
    width: 100%;
}

.login-card {
    background: white;
    padding: 48px;
    border-radius: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.login-logo {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 24px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-blue-hover);
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toast {
    background: white;
    border-left: 4px solid var(--success-color);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    padding: 16px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show {
    transform: translateX(0);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--primary-blue);
}
input:checked + .slider:before {
    transform: translateX(20px);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}
.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.tab-btn:hover {
    color: var(--primary-blue);
}
.tab-btn.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dropdown Menu */
.user-profile {
    position: relative;
}
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    min-width: 150px;
    display: none;
    z-index: 100;
}
.dropdown-menu.active {
    display: block;
    animation: fadeIn 0.2s ease;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
}
.dropdown-item:hover {
    background: #f3f4f6;
    color: var(--primary-blue);
}
.dropdown-item.text-danger {
    color: var(--danger-color);
}
.dropdown-item.text-danger:hover {
    background: #fee2e2;
}

/* Interactive Location Items */
.location-item {
    cursor: pointer;
    transition: all 0.2s ease;
}
.location-item:hover {
    background: #f9fafb;
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}



/* Interactive Cards */
.interactive-card {
    transition: all 0.3s ease;
    cursor: pointer;
}
.interactive-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: var(--primary-blue);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: white;
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    transform: translateY(20px);
    transition: transform 0.3s;
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
}
