@font-face {
    font-family: 'Alverata Informal';
    src: url('../fonts/AlverataInformal.woff2') format('woff2'),
         url('../fonts/AlverataInformal.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body, html { 
    margin: 0; 
    padding: 0; 
    font-family: 'Alverata Informal', sans-serif;
    line-height: 1.4;
    font-weight: normal;
}

.container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header .logo { height: 50px; margin-bottom: 0; }
.header .logo img { height: 100%; }
.header nav a {
    margin-left: 20px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
}
.header nav a.btn-cameras {
    background-color: #007bff;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
}
.page-home {
    text-align: center;
    padding-top: 40px;
}
.logo2x img {
    height: 120px;
    margin-bottom: 20px;
}

.body-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f4f4f4;
}
.login-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 300px;
    text-align: center;
}
.form-logo { margin-bottom: 20px; }
.form-logo img { height: 80px; }
.form-group {
    margin-bottom: 15px;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.form-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box; 
    border: 1px solid #ccc;
    border-radius: 4px;
}
.btn-login {
    width: 100%;
    padding: 10px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}
.btn-login:hover { background-color: #218838; }
.error-msg {
    color: #D8000C;
    background-color: #FFD2D2;
    padding: 8px;
    border-radius: 5px;
    font-size: 14px;
}

.body-dashboard {
    background-color: #121212; 
    color: #e0e0e0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.header-cameras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2a2e; 
    margin-bottom: 25px;
    padding-bottom: 15px;
}
.header-cameras h1 {
    font-family: 'Alverata Informal', sans-serif; 
    color: #ffffff;
    margin: 0;
}

.btn-logout {
    background-color: #dc3545;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.btn-logout:hover {
    background-color: #c82333;
}

.nvr-group {
    width: 100%;
    margin-bottom: 30px;
    background-color: transparent;
    box-shadow: none;
    padding: 0;
}
.nvr-group h2 {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: none;
    padding-bottom: 0;
    font-family: 'Alverata Informal', sans-serif;
    color: #ffffff;
    font-size: 22px;
}

.cam-scroll-wrapper {
    display: flex;
    overflow-x: auto; 
    overflow-y: hidden;
    white-space: nowrap; 
    padding-bottom: 15px; 
}

.cam-button {
    background-color: #1e1e1e; 
    border: 1px solid #2a2a2e; 
    border-radius: 12px;
    color: #e0e0e0;
    display: inline-block; 
    vertical-align: top;
    padding: 15px;
    text-align: left;
    cursor: pointer;
    min-width: 150px; 
    min-height: 100px;
    margin-right: 12px; 
    white-space: normal; 
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.cam-button:last-child {
    margin-right: 0; 
}
.cam-button:hover {
    border-color: #007bff; 
}
.cam-name {
    font-size: 16px;
    font-weight: 600; 
    color: #ffffff;
    line-height: 1.3;
    word-break: break-word; 
}
.cam-status {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: #34C759; 
    margin-top: 15px; 
}
.cam-status-dot {
    width: 8px;
    height: 8px;
    background-color: #34C759;
    border-radius: 50%;
    margin-right: 6px;
    animation: blink 1.5s linear infinite;
}
.cam-scroll-wrapper::-webkit-scrollbar {
    height: 8px;
}
.cam-scroll-wrapper::-webkit-scrollbar-track {
    background: #2a2a2e;
    border-radius: 4px;
}
.cam-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}
.cam-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #777;
}

.modal-overlay {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); 
    justify-content: center;
    align-items: center;
    padding: 10px; 
    box-sizing: border-box;
}

.modal-content {
    background: #1e1e1e; 
    border: 1px solid #2a2a2e;
    border-radius: 8px;
    padding: 15px; 
    box-sizing: border-box;
    width: 100%; 
    max-width: 1100px; 
    height: auto; 
    position: relative; 
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-height: 200px;
}

.close-button {
    position: absolute;
    top: 5px; 
    right: 10px; 
    color: #aaa; 
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10; 
}
.close-button:hover {
    color: #fff;
}

#video { 
    width: 100%; 
    height: auto; 
    max-height: 85vh; 
    display: none; 
    background: #000; 
}

#loading-spinner {
    border: 8px solid #333;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    display: none;
    flex-shrink: 0; 
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}