/* Hotel CCTV Monitoring System - Styles */
/* Color Scheme: Modern Gray + Accent Colors */
/* Font: Pretendard Variable */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css');

:root {
    /* Gray Scale */
    --gray-50: #f2f4f6;
    --gray-100: #e7eaed;
    --gray-200: #b0b8c1;
    --gray-300: #8b95a1;
    --gray-400: #6b7684;
    --gray-500: #4d5867;
    --gray-600: #2f343d;
    --gray-700: #191f28;
    
    /* Primary Blue */
    --blue-50: #e8f2ff;
    --blue-500: #3182f6;
    
    /* Semantic Colors */
    --red-500: #f04452;
    --yellow-200: #ffcfa1;
    --green-200: #a0d6b6;
    --red-200: #f08384;
    
    /* Functional */
    --success: #a0d6b6;
    --warning: #ffcfa1;
    --danger: #f04452;
    --info: #3182f6;
    
    /* Background & Surface */
    --bg-primary: var(--gray-700);
    --bg-secondary: var(--gray-600);
    --bg-surface: #ffffff;
    --bg-content: var(--gray-50);
    
    /* Text */
    --text-primary: var(--gray-700);
    --text-secondary: var(--gray-400);
    --text-muted: var(--gray-300);
    --text-inverse: #ffffff;
    
    /* Border */
    --border-light: var(--gray-100);
    --border-default: var(--gray-200);
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
}

/* App Shell */
.app-shell {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--gray-700) 0%, var(--gray-600) 100%);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

/* Top Bar */
.top-bar {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(25, 31, 40, 0.85);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 100;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 101;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn span {
    width: 24px;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s;
    display: block;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #ffffff;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lang-switch {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px;
}

.lang-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--gray-300);
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    color: #ffffff;
}

.lang-btn.active {
    background: var(--blue-500);
    color: #ffffff;
}

.user-info {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-200);
}

.logout-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Layout */
.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 64px);
    transition: grid-template-columns 0.25s ease;
    width: 100%;
    overflow-x: hidden;
}

.layout.layout-collapsed {
    grid-template-columns: 72px 1fr;
}

/* Sidebar */
.sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(25, 31, 40, 0.6);
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease;
    width: 240px;
    min-width: 240px;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 72px;
    min-width: 72px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 16px 12px;
}

.collapse-btn {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: var(--gray-200);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collapse-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px 16px;
}

.nav-item {
    border: none;
    background: transparent;
    color: var(--gray-200);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item .nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
    flex-shrink: 0;
}

.nav-item .nav-label {
    white-space: nowrap;
    overflow: hidden;
}

.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-parent {
    justify-content: space-between;
}

.caret {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.6;
    transition: transform 0.2s;
}

.caret.open {
    transform: rotate(180deg);
}

.nav-item.nav-sub {
    padding-left: 44px;
    font-size: 13px;
}

.nav-sublist {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 0;
}

.nav-item.active {
    background: var(--blue-500);
    color: #ffffff;
}

.nav-item.active .nav-dot {
    background: #ffffff;
}

.nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* Main Content */
.content {
    padding: 28px 32px 48px;
    background: var(--bg-content);
    color: var(--text-primary);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100%;
    width: 100%;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.eyebrow {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: var(--text-secondary);
}

h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--gray-700);
}

h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--gray-700);
}

h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
}

/* Panel / Card */
.panel {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
}

.card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-700);
    letter-spacing: -1px;
}

.stat-card.blue {
    border-color: var(--blue-500);
    background: linear-gradient(135deg, var(--blue-50) 0%, #ffffff 100%);
}

.stat-card.blue .stat-value {
    color: var(--blue-500);
}

.stat-card.green {
    border-color: var(--green-200);
    background: linear-gradient(135deg, rgba(160, 214, 182, 0.2) 0%, #ffffff 100%);
}

.stat-card.green .stat-value {
    color: #2d8a54;
}

.stat-card.yellow {
    border-color: var(--yellow-200);
    background: linear-gradient(135deg, rgba(255, 207, 161, 0.2) 0%, #ffffff 100%);
}

.stat-card.yellow .stat-value {
    color: #c76e00;
}

.stat-card.red {
    border-color: var(--red-500);
    background: linear-gradient(135deg, rgba(240, 68, 82, 0.08) 0%, #ffffff 100%);
}

.stat-card.red .stat-value {
    color: var(--red-500);
}

.stat-card.purple {
    border-color: #9333ea;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.08) 0%, #ffffff 100%);
}

.stat-card.purple .stat-value {
    color: #9333ea;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--blue-500);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(49, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2970e3;
    box-shadow: 0 4px 12px rgba(49, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--gray-50);
    color: var(--gray-600);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.btn-danger {
    background: var(--red-500);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(240, 68, 82, 0.3);
}

.btn-danger:hover {
    background: #dc2e3d;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-500);
    border: 1px solid var(--border-default);
}

.btn-ghost:hover {
    background: var(--gray-50);
    color: var(--gray-700);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

/* Link Button */
.link-btn {
    background: none;
    border: none;
    color: var(--blue-500);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
}

.link-btn:hover {
    color: #2970e3;
    text-decoration: underline;
}

/* Tables */
.table {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--border-light);
}

.table-head {
    display: grid;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    background: var(--gray-50);
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 1px solid var(--border-light);
}

.table-body {
    display: flex;
    flex-direction: column;
}

.table-row {
    display: grid;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}

.table-row:last-child {
    border-bottom: none;
}

.table-row.clickable {
    cursor: pointer;
}

.table-row.clickable:hover {
    background: var(--gray-50);
}

.table-row.active {
    background: var(--blue-50);
}

/* Home Table */
.home-table .table-head,
.home-table .table-row {
    grid-template-columns: 1.5fr 0.8fr 0.8fr;
}

/* Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.status-confirmed {
    background: rgba(160, 214, 182, 0.25);
    color: #1d7a42;
}

.status-pending {
    background: rgba(176, 184, 193, 0.25);
    color: var(--gray-500);
}

.status-reviewing {
    background: rgba(255, 207, 161, 0.35);
    color: #b35c00;
}

.status-online {
    background: rgba(160, 214, 182, 0.25);
    color: #1d7a42;
}

.status-offline {
    background: rgba(176, 184, 193, 0.25);
    color: var(--gray-500);
}

/* Legend */
.legend {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.green { background: var(--green-200); }
.legend-dot.yellow { background: var(--yellow-200); }
.legend-dot.red { background: var(--red-200); }
.legend-dot.blue { background: var(--blue-500); }

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group input,
.filter-group select {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    background: #ffffff;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(49, 130, 246, 0.15);
}

/* Monitor Grid */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.monitor-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s, transform 0.2s;
}

.monitor-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.monitor-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.monitor-video {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.monitor-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder {
    color: var(--gray-400);
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.live-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    background: var(--red-500);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.monitor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.viewer-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Video Three Column Layout */
.video-three-col {
    display: grid;
    grid-template-columns: 1fr 1.4fr 0.8fr;
    gap: 16px;
    margin-top: 20px;
}

.video-col {
    min-width: 0;
}

.video-col .panel {
    height: 100%;
}

.event-list {
    max-height: 450px;
    overflow-y: auto;
}

.event-item {
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 0.6fr 0.6fr;
    align-items: center;
    padding: 12px 14px;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
}

.event-item:hover {
    background: var(--gray-50);
}

.event-item.active {
    background: var(--blue-50);
}

.event-item:last-child {
    border-bottom: none;
}

.branch-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.branch-cell .branch-name {
    font-weight: 600;
    font-size: 14px;
}

.branch-cell .camera-name {
    font-size: 12px;
    color: var(--text-secondary);
}

.event-type-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.event-type-badge.cash {
    background: var(--blue-50);
    color: var(--blue-500);
}

.event-type-badge.potential_cash {
    background: rgba(153, 102, 255, 0.15);
    color: #7c3aed;
}

.event-type-badge.violence {
    background: rgba(240, 131, 132, 0.2);
    color: #c4363f;
}

.event-type-badge.fire {
    background: rgba(255, 207, 161, 0.35);
    color: #b35c00;
}

/* Video Viewer */
.video-viewer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-body {
    flex: 1;
    min-height: 280px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-weight: 500;
}

/* Status Panel */
.status-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.status-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.status-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.status-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(25, 31, 40, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    font-size: 18px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-50);
    color: var(--gray-500);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

.modal-video {
    height: 280px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-weight: 500;
}

/* Form */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    background: #ffffff;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(49, 130, 246, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Manage Section */
.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
}

.manage-filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.manage-table .table-head,
.manage-table .table-row {
    grid-template-columns: 1.5fr 1fr 0.8fr 0.6fr;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-default);
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.page-btn.active {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: #ffffff;
}

/* Reports */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chart-container {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px;
}

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

.chart-header h3 {
    font-size: 15px;
}

.chart-body {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pie-chart-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 15px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-default);
    border-top-color: var(--blue-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: 10px;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.toast-success { background: #1d7a42; }
.toast-error { background: var(--red-500); }
.toast-info { background: var(--blue-500); }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-700) 0%, var(--gray-600) 100%);
    padding: 24px;
}

.login-card {
    width: min(420px, 100%);
    background: #ffffff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

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

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-form .btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.login-error {
    background: rgba(240, 68, 82, 0.1);
    color: var(--red-500);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
}

.login-lang {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

/* Responsive - Improved for all screen sizes */

/* Large screens (1440px+) */
@media (min-width: 1440px) {
    .monitor-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .video-three-col {
        grid-template-columns: 1.2fr 1.5fr 1fr;
    }
}

/* Medium-large screens (1200-1439px) */
@media (max-width: 1439px) and (min-width: 1200px) {
    .monitor-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Medium screens (1024-1199px) */
@media (max-width: 1199px) and (min-width: 1025px) {
    .monitor-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .video-three-col {
        grid-template-columns: 1fr 1fr;
    }
    
    .video-three-col > .video-col:last-child {
        grid-column: 1 / -1;
    }
}

/* Tablet screens (768-1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .video-three-col {
        grid-template-columns: 1fr;
    }
    
    .pie-chart-container {
        flex-direction: column;
    }
    
    .top-bar {
        padding: 0 16px;
    }
    
    .content {
        padding: 24px 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .event-item {
        grid-template-columns: 1fr 0.5fr 0.5fr;
        font-size: 13px;
    }
    
    .event-item > span:nth-child(3) {
        display: none; /* Hide time column on tablets */
    }
}

/* Desktop - ensure mobile menu button is hidden */
@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
    
    .mobile-menu-backdrop {
        display: none !important;
    }
    
    .sidebar {
        position: relative;
        left: 0;
        height: auto;
        padding-top: 0;
        box-shadow: none;
    }
}

/* Mobile screens (below 768px) */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr !important;
    }
    
    .layout.layout-collapsed {
        grid-template-columns: 1fr !important;
    }

    .mobile-menu-btn {
        display: flex !important;
        touch-action: manipulation;
    }
    
    /* Mobile Menu Backdrop */
    .mobile-menu-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 98;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .mobile-menu-backdrop.active {
        display: block;
        opacity: 1;
    }

    .sidebar {
        position: fixed !important;
        top: 0;
        left: -100% !important;
        height: 100vh;
        width: 75vw !important;
        max-width: 300px;
        min-width: unset !important;
        z-index: 99;
        background: var(--gray-700);
        transition: left 0.3s ease;
        overflow-y: auto;
        padding-top: 64px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.mobile-open {
        left: 0 !important;
    }
    
    /* Override collapsed state on mobile - important to prevent flash */
    .sidebar.collapsed {
        position: fixed !important;
        width: 75vw !important;
        max-width: 300px;
        min-width: unset !important;
        left: -100% !important;
    }
    
    .sidebar.collapsed.mobile-open {
        left: 0 !important;
    }
    
    /* Make nav items more visible on mobile */
    .sidebar .nav-item {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .sidebar .nav-label {
        display: block !important;
        opacity: 1 !important;
    }
    
    .sidebar .collapse-btn {
        display: none !important;
    }
    
    .sidebar-header {
        display: none !important;
    }


    .content {
        padding: 16px 12px;
    }
    
    .top-bar {
        height: 56px;
        padding: 0 12px;
    }
    
    .brand {
        font-size: 16px;
    }
    
    .top-actions {
        gap: 8px;
    }
    
    .lang-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .user-info {
        display: none; /* Hide username on mobile */
    }
    
    .logout-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    h1 {
        font-size: 22px;
    }
    
    h2 {
        font-size: 18px;
    }

    .monitor-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .monitor-card {
        padding: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Video logs - single column on mobile */
    .video-three-col {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 28px;
    }

    .filters {
        flex-direction: column;
        gap: 12px;
    }

    .filter-group {
        width: 100%;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    
    .panel {
        padding: 16px;
        border-radius: 12px;
    }
    
    .event-item {
        grid-template-columns: 1fr auto;
        gap: 8px;
        padding: 10px 12px;
    }
    
    .event-item > span:nth-child(3),
    .event-item > span:nth-child(4) {
        display: none; /* Hide time and status on mobile */
    }
    
    .event-type-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .status-row {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Small mobile screens (below 480px) */
@media (max-width: 480px) {
    .content {
        padding: 12px 10px;
    }
    
    .top-bar {
        height: 52px;
    }
    
    .brand {
        font-size: 14px;
    }
    
    .lang-switch {
        gap: 2px;
        padding: 2px;
    }
    
    .lang-btn {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .viewer-body {
        min-height: 200px;
    }
}

/* Back Link */
.back-link {
    font-size: 13px;
    color: var(--blue-500);
    font-weight: 500;
    margin-bottom: 4px;
}

.back-link:hover {
    text-decoration: underline;
}

.branch-region {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Detail Section */
.detail-section {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

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

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.info-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Camera Mapping Grid */
.camera-mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.camera-map-card {
    background: var(--gray-50);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.camera-map-preview {
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-200);
}

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

.camera-map-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.camera-map-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.camera-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.camera-thresholds {
    font-size: 11px;
}

.camera-map-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.full-width {
    grid-column: 1 / -1;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.status-success {
    background: rgba(160, 214, 182, 0.25);
    color: #1d7a42;
}

.status-danger {
    background: rgba(240, 68, 82, 0.15);
    color: var(--red-500);
}

.status-warning {
    background: rgba(255, 207, 161, 0.35);
    color: #b35c00;
}

.status-info {
    background: var(--blue-50);
    color: var(--blue-500);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-icon svg {
    width: 24px;
    height: 24px;
}

.icon-primary {
    background: var(--blue-50);
    color: var(--blue-500);
}

.icon-danger {
    background: rgba(240, 68, 82, 0.15);
    color: var(--red-500);
}

.icon-warning {
    background: rgba(255, 207, 161, 0.35);
    color: #b35c00;
}

.icon-success {
    background: rgba(160, 214, 182, 0.25);
    color: #1d7a42;
}

.summary-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    padding: 20px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    margin-bottom: 24px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px;
}

.chart-card h3 {
    margin-bottom: 16px;
}

.chart-card canvas {
    max-height: 280px;
}

/* Report Table */
.report-table-section {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px;
}

.report-table-section h3 {
    margin-bottom: 16px;
}

.report-table-section .table-head,
.report-table-section .table-row {
    grid-template-columns: 1fr 1.2fr 1fr 0.6fr 0.6fr 0.6fr;
}

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

/* Video Logs Table */
.logs-table .table-head,
.logs-table .table-row {
    grid-template-columns: 1.2fr 1fr 0.8fr 0.8fr 0.6fr 0.5fr;
}

/* Video Full Table */
.videos-table .table-head,
.videos-table .table-row {
    grid-template-columns: 1.2fr 1fr 0.8fr 0.6fr 0.5fr;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.font-mono { font-family: 'SF Mono', 'Roboto Mono', monospace; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar .filter-group {
        width: 100%;
    }
}
