/* ========= ШРИФТЫ ========= */
@font-face {
    font-family: 'Comfortaa';
    src: url('../fonts/Comfortaa-Regular.ttf') format('truetype');
    font-weight: normal;
}
@font-face {
    font-family: 'Comfortaa';
    src: url('../fonts/Comfortaa-Bold.ttf') format('truetype');
    font-weight: bold;
}
@font-face {
    font-family: 'Comfortaa';
    src: url('../fonts/Comfortaa-Medium.ttf') format('truetype');
    font-weight: 500;
}
@font-face {
    font-family: 'Comfortaa';
    src: url('../fonts/Comfortaa-SemiBold.ttf') format('truetype');
    font-weight: 600;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Regular.ttf') format('truetype');
    font-weight: normal;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Bold.ttf') format('truetype');
    font-weight: bold;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-SemiBold.ttf') format('truetype');
    font-weight: 600;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Medium.ttf') format('truetype');
    font-weight: 500;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0b1215;
    --bg-secondary: #0a1f1a;
    --bg-card: rgba(12, 28, 22, 0.7);
    --accent-primary: #10b981;
    --accent-secondary: #14b8a6;
    --accent-light: #2dd4bf;
    --text-primary: #e2f0e8;
    --text-secondary: #a7f3d0;
    --text-muted: #6b9c8a;
    --border-color: #1e3a2f;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
}

body {
    font-family: 'Montserrat', 'Comfortaa', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========= СТРАНИЦЫ ВХОДА ========= */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 30%, #0a1f1a, #030a07);
}

.login-card {
    background: rgba(10, 25, 20, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid #2c5a4a;
    width: 420px;
    padding: 48px;
    border-radius: 40px;
    box-shadow: 0 25px 45px -12px rgba(0,0,0,0.6);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo .logo-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.login-logo h1 {
    font-family: 'Comfortaa', sans-serif;
    font-size: 1.75rem;
    background: linear-gradient(135deg, #a7f3d0, #2dd4bf);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.login-card h2 {
    background: linear-gradient(135deg, #a7f3d0, #2dd4bf);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 24px;
    text-align: center;
}

/* ========= БОКОВОЕ МЕНЮ ========= */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0a1f1a 0%, #030e0b 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.logo-area {
    padding: 28px 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.logo-area h2 {
    font-family: 'Comfortaa', sans-serif;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #a7f3d0, #2dd4bf, #10b981);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 4px;
}

.logo-area p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px 20px 12px;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    background: rgba(16, 185, 129, 0.15);
    color: white;
}

.nav-links .active {
    background: linear-gradient(95deg, var(--accent-primary), var(--accent-secondary));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* ========= ОСНОВНОЙ КОНТЕНТ ========= */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--bg-primary);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, #ffffff, #6ee7b7, #2dd4bf);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-family: 'Comfortaa', sans-serif;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* ========= КАРТОЧКИ ========= */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #2a5a48;
    transition: all 0.2s ease;
}

.card:hover {
    border-color: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 20px 30px -12px rgba(0,0,0,0.5);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========= СЕТКИ ========= */
.grid-2cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-4cols {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ========= СТАТИСТИКА ========= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid #2a5a48;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-light), var(--accent-primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========= КАРТА ========= */
.map-placeholder {
    background: linear-gradient(135deg, #0b1f18, #05140f);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 500;
    border: 1px dashed #2a5a48;
    min-height: 300px;
    gap: 16px;
}

.map-placeholder .icon {
    font-size: 4rem;
    opacity: 0.5;
}

/* ========= ТАБЛИЦЫ ========= */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th, td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--accent-light);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

td {
    color: var(--text-primary);
}

/* ========= БЭЙДЖИ ========= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-high { 
    background: rgba(239, 68, 68, 0.15); 
    color: #fca5a5; 
}

.badge-medium { 
    background: rgba(245, 158, 11, 0.15); 
    color: #fcd34d; 
}

.badge-low { 
    background: rgba(16, 185, 129, 0.15); 
    color: #a7f3d0; 
}

.badge-done { 
    background: rgba(16, 185, 129, 0.2); 
    color: #6ee7b7; 
}

.badge-progress { 
    background: rgba(245, 158, 11, 0.2); 
    color: #fed7aa; 
}

.badge-new {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* ========= КНОПКИ ========= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(95deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-light);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(16, 185, 129, 0.25);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-light);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

/* ========= ФОРМЫ ========= */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

label {
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    background: #0b1f18;
    border: 1px solid #2a5a48;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b9c8a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ========= КАМЕРЫ ========= */
.cam-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.cam-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #2a5a48;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}

.cam-card:hover {
    border-color: var(--accent-light);
    transform: translateY(-4px);
}

.cam-preview {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1a2f28, #0a1f1a);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cam-preview::after {
    content: '📹';
    font-size: 2.5rem;
    opacity: 0.5;
}

.cam-info {
    padding: 16px;
}

.cam-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.cam-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.live-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========= АРХИВ ========= */
.archive-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-day:hover {
    border-color: var(--accent-primary);
}

.calendar-day.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.calendar-day.has-recording {
    position: relative;
}

.calendar-day.has-recording::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: var(--accent-light);
    border-radius: 50%;
}

.timeline {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.timeline-item {
    flex-shrink: 0;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    min-width: 100px;
}

.timeline-item.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.timeline-item .time {
    font-weight: 600;
    font-size: 0.9rem;
}

.timeline-item .duration {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 4px;
}

/* ========= ФИЛЬТРЫ ========= */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    margin: 0;
    font-size: 0.8rem;
}

.filter-group select {
    width: auto;
    min-width: 150px;
    padding: 8px 32px 8px 12px;
}

.search-input {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-input input {
    padding-left: 40px;
}

.search-input::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

/* ========= ДЕТАЛЬНАЯ КАРТОЧКА ========= */
.detail-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.detail-avatar {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
}

.detail-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.detail-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.detail-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.detail-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* ========= СПИСКИ ДАННЫХ ========= */
.data-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.data-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.data-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.data-item-content {
    flex: 1;
}

.data-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.data-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.data-item-actions {
    display: flex;
    gap: 8px;
}

/* ========= ГРАФИКИ (ЗАГЛУШКИ) ========= */
.chart-placeholder {
    aspect-ratio: 16/7;
    background: linear-gradient(135deg, #0b1f18, #05140f);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border: 1px dashed #2a5a48;
    color: var(--text-muted);
}

.chart-placeholder .icon {
    font-size: 3rem;
    opacity: 0.5;
}

/* ========= СОБЫТИЯ ЛЕНТА ========= */
.events-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border-left: 3px solid var(--accent-primary);
}

.event-item.alert {
    border-left-color: var(--warning);
}

.event-item.danger {
    border-left-color: var(--danger);
}

.event-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 50px;
    flex-shrink: 0;
}

.event-content {
    flex: 1;
}

.event-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.event-description {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========= ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ========= */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ========= АДАПТИВНОСТЬ ========= */
@media (max-width: 1200px) {
    .cam-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 240px;
    }
    
    .grid-2cols,
    .grid-3cols {
        grid-template-columns: 1fr;
    }
    
    .grid-4cols {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 60px;
        overflow: hidden;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .sidebar.expanded {
        max-height: none;
    }
    
    .logo-area {
        padding: 16px;
        margin: 0;
        cursor: pointer;
    }
    
    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
    }
    
    .nav-links a {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .page-title {
        font-size: 1.4rem;
    }
    
    .cam-grid,
    .stats-grid,
    .grid-4cols {
        grid-template-columns: 1fr;
    }
}

/* ===== MOBILE ADAPTATION ===== */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 60px;
        overflow: hidden;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
    }
    
    .sidebar.expanded {
        max-height: none;
    }
    
    .logo-area {
        padding: 16px;
        margin: 0;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .logo-area::after {
        content: '☰';
        font-size: 1.5rem;
        color: var(--accent-light);
    }
    
    .nav-links {
        flex-direction: column;
        padding: 0 16px 16px;
        display: none;
    }
    
    .sidebar.expanded .nav-links {
        display: flex;
    }
    
    .nav-links a {
        padding: 12px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        padding: 16px;
    }
    
    .page-title {
        font-size: 1.4rem;
    }
    
    .stats-grid,
    .grid-2cols,
    .grid-3cols,
    .grid-4cols {
        grid-template-columns: 1fr;
    }
    
    .cam-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .filters-bar {
        flex-direction: column;
        width: 100%;
    }
    
    .search-input {
        max-width: 100%;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 8px 4px;
    }
    
    .detail-header {
        flex-direction: column;
        text-align: center;
    }
    
    .detail-meta {
        justify-content: center;
    }
}
