:root {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.06);
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(13, 148, 136, 0.08), transparent 30%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.08), transparent 30%);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--card-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.02);
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 3rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #0d9488, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-badge {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

nav a:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-main);
}

nav a.active {
    background: rgba(13, 148, 136, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.tenant-info {
    margin-top: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Main Content */
.content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-weight: 600;
    font-size: 1.8rem;
    color: var(--text-main);
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}

.primary-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.3);
}

.secondary-btn {
    background: white;
    color: var(--text-main);
    border: 1px solid rgba(0,0,0,0.1);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.secondary-btn:hover {
    background: #f8fafc;
    border-color: rgba(0,0,0,0.15);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.danger-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.danger-btn:hover {
    background: #dc2626;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

/* List View */
.cameras-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.list-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(16px);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.list-item:hover {
    transform: translateX(4px);
    border-color: rgba(13, 148, 136, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.item-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.thumbnail-img {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    background: #e2e8f0;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.item-badges {
    display: flex;
    gap: 0.5rem;
}

.badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    background: rgba(0,0,0,0.05);
    color: var(--text-muted);
}

.badge.active {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

/* Side Panel */
.side-panel-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 40;
}

.side-panel-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.side-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 420px;
    background: var(--bg-color);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--card-border);
}

.side-panel.open {
    transform: translateX(0);
}

.panel-header {
    padding: 2rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: rgba(255,255,255,0.5);
}

.panel-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.status-indicator-panel {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.5rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-main);
}

.edit-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.download-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.panel-content {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.panel-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.camera-url {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
    background: rgba(0, 0, 0, 0.04);
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.copy-btn {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    padding: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-main);
}

/* Controls */
.control-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.control-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider {
    background-color: var(--primary);
    box-shadow: 0 0 10px rgba(13, 148, 136, 0.2);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Range Sliders */
.range-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.range-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.range-val {
    color: var(--text-main);
    font-weight: 600;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.4);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #e2e8f0;
    border-radius: 2px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 60;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.modal {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    transform: translateY(20px);
    transition: transform 0.2s ease;
}
.modal-overlay.open .modal {
    transform: translateY(0);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}
.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
}
.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15), 0 1px 2px rgba(0,0,0,0.02) inset;
    background: #fff;
}
.form-group input::placeholder {
    color: #94a3b8;
}

.segmented-control {
    display: flex;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
}
.segmented-control button {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}
.segmented-control button.active {
    background: white;
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Custom Select Dropdown */
.custom-select-container {
    position: relative;
    width: 100%;
    font-family: 'Inter', sans-serif;
}
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: #fff;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}
.custom-select-trigger:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}
.custom-select-container.open .custom-select-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.custom-select-container.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.custom-select-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(0,0,0,0.02);
}
.custom-select-item:last-child {
    border-bottom: none;
}
.custom-select-item:hover {
    background: #f1f5f9;
}
.item-thumb {
    width: 50px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    background: #e2e8f0;
    margin-right: 0.75rem;
    flex-shrink: 0;
}
.item-label {
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.item-badge {
    font-size: 0.65rem;
    background: #e2e8f0;
    color: #475569;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 0.5rem;
    font-weight: 600;
}
.chevron-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.custom-select-container.open .chevron-icon {
    transform: rotate(180deg);
}

/* Camera Grid & Cards */
.camera-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}
.camera-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.025);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}
.camera-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}
.camera-card-thumb-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
}
.camera-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.camera-card:hover .camera-card-thumb {
    transform: scale(1.05);
}
.camera-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.camera-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.camera-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.camera-card-stats {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}
.stat-pill {
    background: #f1f5f9;
    color: #475569;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Live Viewers Badge */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(13, 148, 136, 0.1);
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}
.live-badge.active {
    opacity: 1;
}
.live-badge svg {
    width: 14px;
    height: 14px;
}
