/* ========================================= */
/* 1. Base Styles & Body Reset */
/* ========================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Clean Grayscale Gradient Background */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    transition: background 0.5s ease;
}

/* ========================================= */
/* 2. Login Box/Container */
/* ========================================= */
.login-box {
    width: 90%; /* Default width for medium screens */
    max-width: 480px; /* Max width for desktop (Portrait Style) */
    background: rgba(255, 255, 255, 0.95); /* Slightly transparent white */
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); /* Soft, deep shadow */
    overflow: hidden;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.5); /* Glass-like edge */
    backdrop-filter: blur(5px); /* Soft blur effect */
    transition: all 0.4s ease;
}

/* Desktop-Specific (Landscape) Size */
@media (min-width: 992px) {
    .login-box {
        max-width: 550px; /* Slightly wider on desktop */
        transform: scale(1.05); /* Make it pop out slightly */
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    }
}

/* ========================================= */
/* 3. Header/Logo Section (iTechGlobal) */
/* ========================================= */
.header-logo {
    text-align: center;
    padding: 35px 20px 25px;
    background-color: #3F51B5; /* Deep Blue Primary Color */
    color: white;
    border-bottom: 8px solid #FF9800; /* Bold Orange accent */
}
.header-logo .logo-icon {
    font-size: 60px;
    display: block;
    margin-bottom: 10px;
    line-height: 1;
}
.header-logo h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.header-logo p {
    margin: 5px 0 0;
    font-size: 16px;
    font-weight: 300;
    opacity: 0.8;
}

/* ========================================= */
/* 4. Form Content and Inputs */
/* ========================================= */
.login-form-content {
    padding: 40px;
}

.login-form-content h2 {
    margin-top: 0;
    margin-bottom: 30px;
    text-align: center;
    color: #3F51B5;
    font-size: 26px;
    font-weight: 600;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 8px; /* Rounded inputs */
    box-sizing: border-box;
    font-size: 17px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: #3F51B5;
    box-shadow: 0 0 8px rgba(63, 81, 181, 0.4);
    outline: none;
}

/* Submit Button */
button[type="submit"] {
    width: 100%;
    background-color: #4CAF50; /* Primary Green */
    color: white;
    padding: 16px 20px;
    margin: 10px 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 19px;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
}

button[type="submit"]:hover {
    background-color: #388E3C; /* Darker Green on hover */
    transform: translateY(-3px);
}

/* Links and Messages */
.login-form-content p {
    text-align: center;
    font-size: 15px;
    margin-top: 30px;
    color: #555;
}
.login-form-content a {
    color: #FF9800; /* Orange Accent */
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s;
}
.login-form-content a:hover {
    text-decoration: underline;
    color: #FBC02D;
}

/* ========================================= */
/* 5. Footer Styles (Creavto) */
/* ========================================= */
.footer {
    width: 100%;
    max-width: 550px; /* Match max desktop width */
    text-align: center;
    font-size: 14px;
    color: #555;
    margin-top: 15px;
}
.footer a {
    color: #3F51B5;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}
.footer a:hover {
    color: #FF9800;
}

/* ========================================= */
/* 6. Mobile Optimization (Portrait) */
/* ========================================= */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .login-box {
        border-radius: 0; /* Full screen look on small phones */
        box-shadow: none;
    }
    .login-form-content {
        padding: 25px;
    }
    .header-logo {
        padding: 30px 15px 20px;
    }
    .header-logo h1 {
        font-size: 26px;
    }
    .footer {
        max-width: 100%;
        font-size: 12px;
    }
}

/* ========================================= */
/* --- NEW STYLES FOR ADMIN & EMPLOYEE --- */
/* ========================================= */

/* General Header for Admin/Employee Pages */
.main-header {
    width: 100%;
    padding: 20px 40px;
    background-color: #3F51B5; /* Deep Blue */
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.logo-area h1 {
    font-size: 24px;
    margin: 0;
}
.logo-area p {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
}

.logout-btn {
    background-color: #FF9800; /* Orange Accent */
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
}
.logout-btn:hover {
    background-color: #FBC02D;
}

/* ========================================= */
/* Admin Dashboard (admin.php) */
/* ========================================= */
.admin-container {
    width: 95%;
    max-width: 1400px;
    margin: 30px auto;
}

.monitoring-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.monitoring-table thead th {
    background-color: #1a237e; /* Darker Blue Header */
    color: white;
    padding: 15px 10px;
    text-align: left;
    font-size: 14px;
    text-transform: uppercase;
}

.monitoring-table tbody td {
    padding: 15px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 14px;
}

.monitoring-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}
.monitoring-table tbody tr:hover {
    background-color: #e3f2fd; /* Light Blue on hover */
}

/* Status Styling */
.status-online {
    font-weight: bold;
    color: #4CAF50; /* Green */
}
.status-offline {
    font-weight: bold;
    color: #F44336; /* Red */
}

/* Image Previews */
.monitor-img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}
.monitor-img:hover {
    transform: scale(1.5);
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Chat Button */
.chat-button {
    background-color: #3F51B5;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.chat-button:hover {
    background-color: #5C6BC0;
}


/* ========================================= */
/* Employee Dashboard (employee.php) */
/* ========================================= */
.employee-header {
    background-color: #1a237e;
}
.employee-container {
    padding: 30px;
    width: 90%;
    max-width: 1200px;
    margin: 30px auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.monitoring-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    margin-bottom: 30px;
}

.preview-box {
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.preview-box h3 {
    color: #3F51B5;
    margin-top: 0;
    font-size: 18px;
}

.monitor-preview {
    width: 350px; /* Standard size for desktop preview */
    height: 250px;
    border: 5px solid #ccc;
    background: #000;
    border-radius: 4px;
    display: block;
}

/* ========================================= */
/* Chat Box Styles (Common for Admin & Employee) */
/* ========================================= */
.chat-container {
    width: 350px;
    height: 500px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

/* Admin Chat Box Position (Fixed to bottom right) */
.admin-container .chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    height: 450px; 
}
/* Employee Chat Box Position (Relative to content, or use fixed if needed) */
.employee-chat-fixed {
    position: fixed; /* Keep it fixed on the employee screen */
    bottom: 20px;
    right: 20px;
    height: 450px;
}

.chat-header {
    background-color: #3F51B5;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h4 {
    margin: 0;
    font-size: 16px;
}
.chat-close-btn {
    background: #F44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.chat-messages-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: #f7f7f7;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.message {
    padding: 8px 12px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}
.message p {
    margin: 0;
}
.sent {
    background-color: #DCF8C6; /* Light Green */
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.received {
    background-color: #FFFFFF;
    border: 1px solid #E0E0E0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-form {
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}
.chat-form textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    resize: none;
    margin-bottom: 5px;
    box-sizing: border-box;
}
.send-options {
    display: flex;
    gap: 10px;
    align-items: center;
}
.send-options input[type="file"] {
    flex-grow: 1;
    font-size: 12px;
}
.send-btn {
    background-color: #FF9800;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

/* ========================================= */
/* Mobile Media Queries (Under 768px) */
/* ========================================= */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
    }
    .logo-area {
        margin-bottom: 10px;
    }
    .logout-btn {
        width: 100%;
        text-align: center;
        padding: 8px;
    }
    
    /* Admin Mobile Table */
    .monitoring-table, .monitoring-table tbody, .monitoring-table thead, .monitoring-table tr {
        display: block;
    }
    .monitoring-table thead {
        display: none; /* Hide table headers on small screens */
    }
    .monitoring-table tbody tr {
        margin-bottom: 15px;
        border: 1px solid #ccc;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }
    .monitoring-table tbody td {
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%; /* Make space for the pseudo-element label */
        text-align: right;
    }
    /* Adding label via CSS for mobile readability */
    .monitoring-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
        color: #3F51B5;
    }
    
    /* Temporary hack to add data-labels for Admin PHP */
    .monitoring-table tbody tr td:nth-child(1):before { content: "ID"; }
    .monitoring-table tbody tr td:nth-child(2):before { content: "Status"; }
    .monitoring-table tbody tr td:nth-child(3):before { content: "Camera"; }
    .monitoring-table tbody tr td:nth-child(4):before { content: "Screen"; }
    .monitoring-table tbody tr td:nth-child(5):before { content: "Active"; }
    .monitoring-table tbody tr td:nth-child(6):before { content: "Chat"; }
    
    .monitoring-table tbody tr td:last-child {
        border-bottom: none;
    }

    /* Employee Mobile Preview */
    .monitoring-previews {
        flex-direction: column;
    }
    .monitor-preview {
        width: 100%;
        height: auto;
    }
    
    /* Chat Box Mobile Size */
    .chat-container {
        width: 90%;
        height: 80vh;
        bottom: 10px;
        right: 5%;
        left: 5%;
    }
}
/* ========================================= */
/* --- NEW STYLES FOR ADMIN & EMPLOYEE --- */
/* ========================================= */

/* General Header for Admin/Employee Pages */
.main-header {
    width: 100%;
    padding: 20px 40px;
    background-color: #3F51B5; /* Deep Blue */
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.logo-area h1 {
    font-size: 24px;
    margin: 0;
}
.logo-area p {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
}

.logout-btn {
    background-color: #FF9800; /* Orange Accent */
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
}
.logout-btn:hover {
    background-color: #FBC02D;
}

/* ========================================= */
/* Admin Dashboard (admin.php) */
/* ========================================= */
.admin-container {
    width: 95%;
    max-width: 1400px;
    margin: 30px auto;
}

.monitoring-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.monitoring-table thead th {
    background-color: #1a237e; /* Darker Blue Header */
    color: white;
    padding: 15px 10px;
    text-align: left;
    font-size: 14px;
    text-transform: uppercase;
}

.monitoring-table tbody td {
    padding: 15px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 14px;
}

.monitoring-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}
.monitoring-table tbody tr:hover {
    background-color: #e3f2fd; /* Light Blue on hover */
}

/* Status Styling */
.status-online {
    font-weight: bold;
    color: #4CAF50; /* Green */
}
.status-offline {
    font-weight: bold;
    color: #F44336; /* Red */
}

/* Image Previews */
.monitor-img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}
.monitor-img:hover {
    transform: scale(1.5);
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Chat Button */
.chat-button {
    background-color: #3F51B5;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.chat-button:hover {
    background-color: #5C6BC0;
}


/* ========================================= */
/* Employee Dashboard (employee.php) */
/* ========================================= */
.employee-header {
    background-color: #1a237e;
}
.employee-container {
    padding: 30px;
    width: 90%;
    max-width: 1200px;
    margin: 30px auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.monitoring-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    margin-bottom: 30px;
}

.preview-box {
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.preview-box h3 {
    color: #3F51B5;
    margin-top: 0;
    font-size: 18px;
}

.monitor-preview {
    width: 350px; /* Standard size for desktop preview */
    height: 250px;
    border: 5px solid #ccc;
    background: #000;
    border-radius: 4px;
    display: block;
}

/* ========================================= */
/* Chat Box Styles (Common for Admin & Employee) */
/* ========================================= */
.chat-container {
    width: 350px;
    height: 500px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

/* Admin Chat Box Position (Fixed to bottom right) */
.admin-container .chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    height: 450px; 
}
/* Employee Chat Box Position (Fixed to bottom right) */
.employee-chat-fixed {
    position: fixed; 
    bottom: 20px;
    right: 20px;
    height: 450px;
}

.chat-header {
    background-color: #3F51B5;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h4 {
    margin: 0;
    font-size: 16px;
}
.chat-close-btn {
    background: #F44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.chat-messages-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: #f7f7f7;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.message {
    padding: 8px 12px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}
.message p {
    margin: 0;
}
.sent {
    background-color: #DCF8C6; /* Light Green */
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.received {
    background-color: #FFFFFF;
    border: 1px solid #E0E0E0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-form {
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}
.chat-form textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    resize: none;
    margin-bottom: 5px;
    box-sizing: border-box;
}
.send-options {
    display: flex;
    gap: 10px;
    align-items: center;
}
.send-options input[type="file"] {
    flex-grow: 1;
    font-size: 12px;
}
.send-btn {
    background-color: #FF9800;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

/* ========================================= */
/* Mobile Media Queries (Under 768px) */
/* ========================================= */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
    }
    .logo-area {
        margin-bottom: 10px;
    }
    .logout-btn {
        width: 100%;
        text-align: center;
        padding: 8px;
    }
    
    /* Admin Mobile Table - Stacked rows */
    .monitoring-table, .monitoring-table tbody, .monitoring-table thead, .monitoring-table tr {
        display: block;
    }
    .monitoring-table thead {
        display: none; /* Hide table headers on small screens */
    }
    .monitoring-table tbody tr {
        margin-bottom: 15px;
        border: 1px solid #ccc;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }
    .monitoring-table tbody td {
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%; /* Make space for the pseudo-element label */
        text-align: right;
    }
    /* Adding label via CSS using data-label attribute from PHP */
    .monitoring-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
        color: #3F51B5;
    }
    
    .monitoring-table tbody tr td:last-child {
        border-bottom: none;
        text-align: center;
    }
    
    .monitoring-table .chat-button {
        width: 80%; /* Make button bigger on mobile */
    }
    
    /* Employee Mobile Preview */
    .monitoring-previews {
        flex-direction: column;
    }
    .monitor-preview {
        width: 100%;
        height: auto;
    }
    
    /* Chat Box Mobile Size */
    .chat-container {
        width: 90%;
        height: 80vh;
        bottom: 10px;
        right: 5%;
        left: 5%;
    }
}

/* ========================================= */
/* --- NEW STYLES FOR ADMIN & EMPLOYEE --- */
/* ========================================= */

/* General Header for Admin/Employee Pages */
.main-header {
    width: 100%;
    padding: 20px 40px;
    background-color: #3F51B5; /* Deep Blue */
    color: white;
    display: flex; /* Enable flexbox for side-by-side elements */
    justify-content: space-between; /* Push logo left and logout right */
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.logo-area h1 {
    font-size: 24px;
    margin: 0;
}
.logo-area p {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
}

.logout-btn {
    background-color: #FF9800; /* Orange Accent */
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
}
.logout-btn:hover {
    background-color: #FBC02D;
}

/* ========================================= */
/* Admin Dashboard (admin.php) */
/* ========================================= */
.admin-container {
    width: 95%;
    max-width: 1400px;
    margin: 30px auto;
}

.monitoring-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.monitoring-table thead th {
    background-color: #1a237e; /* Darker Blue Header */
    color: white;
    padding: 15px 10px;
    text-align: left;
    font-size: 14px;
    text-transform: uppercase;
}

.monitoring-table tbody td {
    padding: 15px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 14px;
}

.monitoring-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}
.monitoring-table tbody tr:hover {
    background-color: #e3f2fd; /* Light Blue on hover */
}

/* Status Styling */
.status-online {
    font-weight: bold;
    color: #4CAF50; /* Green */
}
.status-offline {
    font-weight: bold;
    color: #F44336; /* Red */
}

/* Image Previews */
.monitor-img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}
.monitor-img:hover {
    transform: scale(1.5);
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Chat Button */
.chat-button {
    background-color: #3F51B5;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.chat-button:hover {
    background-color: #5C6BC0;
}


/* ========================================= */
/* Employee Dashboard (employee.php) */
/* ========================================= */
.employee-header {
    background-color: #1a237e;
}
.employee-container {
    padding: 30px;
    width: 90%;
    max-width: 1200px;
    margin: 30px auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.monitoring-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    margin-bottom: 30px;
}

.preview-box {
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.preview-box h3 {
    color: #3F51B5;
    margin-top: 0;
    font-size: 18px;
}

.monitor-preview {
    width: 350px; /* Standard size for desktop preview */
    height: 250px;
    border: 5px solid #ccc;
    background: #000;
    border-radius: 4px;
    display: block;
}

/* ========================================= */
/* Chat Box Styles (Common for Admin & Employee) */
/* ========================================= */
.chat-container {
    width: 350px;
    height: 500px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

/* Admin Chat Box Position (Fixed to bottom right) */
.admin-container .chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    height: 450px; 
}
/* Employee Chat Box Position (Fixed to bottom right) */
.employee-chat-fixed {
    position: fixed; 
    bottom: 20px;
    right: 20px;
    height: 450px;
}

.chat-header {
    background-color: #3F51B5;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h4 {
    margin: 0;
    font-size: 16px;
}
.chat-close-btn {
    background: #F44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.chat-messages-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: #f7f7f7;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.message {
    padding: 8px 12px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}
.message p {
    margin: 0;
}
.sent {
    background-color: #DCF8C6; /* Light Green */
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.received {
    background-color: #FFFFFF;
    border: 1px solid #E0E0E0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-form {
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}
.chat-form textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    resize: none;
    margin-bottom: 5px;
    box-sizing: border-box;
}
.send-options {
    display: flex;
    gap: 10px;
    align-items: center;
}
.send-options input[type="file"] {
    flex-grow: 1;
    font-size: 12px;
}
.send-btn {
    background-color: #FF9800;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

/* ========================================= */
/* Mobile Media Queries (Under 768px) */
/* ========================================= */
@media (max-width: 768px) {
    /* Header: Stacked on mobile */
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
    }
    .logo-area {
        margin-bottom: 10px;
    }
    .logout-btn {
        width: 100%;
        text-align: center;
        padding: 8px;
    }
    
    /* Admin Mobile Table - Stacked rows */
    .monitoring-table, .monitoring-table tbody, .monitoring-table thead, .monitoring-table tr {
        display: block;
    }
    .monitoring-table thead {
        display: none; /* Hide table headers on small screens */
    }
    .monitoring-table tbody tr {
        margin-bottom: 15px;
        border: 1px solid #ccc;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }
    .monitoring-table tbody td {
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%; 
        text-align: right;
    }
    /* Adding label via CSS using data-label attribute from PHP */
    .monitoring-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
        color: #3F51B5;
    }
    
    .monitoring-table tbody tr td:last-child {
        border-bottom: none;
        text-align: center;
    }
    
    .monitoring-table .chat-button {
        width: 80%; /* Make button bigger on mobile */
    }
    
    /* Employee Mobile Preview */
    .monitoring-previews {
        flex-direction: column;
    }
    .monitor-preview {
        width: 100%;
        height: auto;
    }
    
    /* Chat Box Mobile Size FIX */
    .chat-container {
        width: 90%;
        height: 65vh; /* Reduced from 80vh to be less full-screen */
        bottom: 10px;
        right: 5%;
        left: 5%;
    }
}

/* ========================================= */
/* --- Employee Chat Toggle Button Style --- */
/* ========================================= */

.chat-toggle-area {
    width: 100%;
    text-align: right; /* Right align the button */
    margin-bottom: 20px;
}
.chat-toggle-btn {
    background-color: #4CAF50; /* Green */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.chat-toggle-btn:hover {
    background-color: #388E3C;
    transform: translateY(-2px);
}

/* Note: The rest of the design for admin/employee pages 
and mobile responsiveness is already in the previous CSS code. 
You only need to ensure this small block is added.
*/

/* ... [All previous CSS styles above this point] ... */

/* Chat Header Style: Should include the button style */
.chat-header {
    background-color: #3F51B5;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between; /* This places the button on the right */
    align-items: center;
}
.chat-close-btn {
    background: #F44336; /* Red background for hide button */
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}
.chat-close-btn:hover {
    background: #D32F2F;
}

/* IMPORTANT: If you added the following in the last step, please remove it as it is no longer needed: */
/*
.chat-toggle-area { ... }
.chat-toggle-btn { ... }
*/

/* [The rest of the previous Media Queries and other styles] */

/* CSS for chat messages */
.message {
    clear: both;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 15px;
    max-width: 80%;
    font-size: 0.9em;
}

/* Messages sent by the current user */
.message.sent {
    background-color: #dcf8c6; /* Light green/blue */
    float: right;
    text-align: right;
}

/* Messages received from the other user */
.message.received {
    background-color: #f1f0f0; /* Light gray/white */
    float: left;
    text-align: left;
}
.message { clear: both; /* ... other styles */ }
.message.sent { float: right; background: #dcf8c6; }
.message.received { float: left; background: #f1f0f0; }

/* css/style.css میں یہ کلاسیں لازمی شامل کریں */

.chat-messages-box {
    /* ... دیگر اسٹائلز جیسے ہائٹ، پیڈنگ ... */
    overflow-y: auto; /* scroll bar enable karny k liye */
    padding: 10px;
    height: 300px; /* ya jo bhi height ap set karna chahty hain */
}

.message {
    /* Ye sab se zaroori property hai: Isy message ko naye line mein laany k liye use karty hain */
    clear: both; 
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word; /* Lamby words/links k liye */
}

.message.sent {
    background-color: #dcf8c6; /* Sent messages ko green color dein */
    float: right; /* Daen taraf shift karein */
}

.message.received {
    background-color: #f1f0f0; /* Received messages ko gray color dein */
    float: left; /* Baen taraf shift karein */
}

/* style.css میں یہ کلاسیں چیک کریں اور شامل کریں */

/* 1. Chat Container ki height aur scroll bar */
.chat-messages-box {
    height: 300px; /* Ya koi bhi fix height */
    overflow-y: auto; /* Scroll bar enable karein */
    padding: 10px;
}

/* 2. Message General Class */
.message {
    /* Ye sabse ZAROORI hai! Har naye message ko naye line se start karta hai */
    clear: both; 
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word; /* Zaroori agar lamba text ho */
}

/* 3. Sent Messages (Right side) */
.message.sent {
    background-color: #dcf8c6; /* ہلکا سبز */
    float: right; 
}

/* 4. Received Messages (Left side) */
.message.received {
    background-color: #f1f0f0; /* ہلکا گرے */
    float: left; 
}

/* Update your existing Modal Styles in the <style> block */
.modal-content {
    margin: auto;
    display: block;
    width: 80%; /* इसे 95% करें ताकि ज़्यादा जगह मिले */
    max-width: 95%; /* मैक्स विड्थ को 95% कर दें */
    max-height: 95%;
    object-fit: contain; 
    
    /* --- NEW ADDITION FOR SHARPNESS --- */
    image-rendering: crisp-edges;
    image-rendering: pixelated; 
    /* या */
    image-rendering: -webkit-optimize-contrast; 
    /* ---------------------------------- */
}
/* ... (Styles above) ... */

/* --- Chat Styles (Optimized and FIXED for Layout) --- */
.admin-chat-fixed { 
    position: fixed; 
    right: 20px; 
    bottom: 20px; 
    width: 360px; /* Chat box ki total chaurai (width) */
    max-height: 70vh; 
    background:#fff; 
    border-radius:8px; 
    box-shadow:0 6px 18px rgba(0,0,0,0.15); 
    display:flex; 
    flex-direction:column; 
    overflow:hidden; 
    z-index: 999;
}
.chat-header { padding:8px 12px; background:#2c3e50; color:#fff; display:flex; justify-content:space-between; align-items:center; }
.chat-messages-box { padding:12px; overflow:auto; flex:1; background:#f7f7f7; }

/* **FIXED CSS for Textarea visibility and alignment** */
.chat-form { 
    padding:8px; 
    border-top:1px solid #eee; 
    display:flex; 
    /* flex-direction: column; Lagane se sab naye line me aa jayega */
    flex-direction: column; 
    gap:8px; 
    align-items:flex-start; /* Controls ko left align rakhen */
}
.chat-form textarea { 
    width: 100%; /* Textarea ko poori chaurai (full width) den */
    resize:vertical; 
    padding:8px; 
    border-radius:6px; 
    border:1px solid #ddd; 
    min-height: 50px; /* **Height thodi aur barhai** */
    max-height: 120px; /* Max height bhi barha di */
    box-sizing: border-box; 
    /* Order ki zarurat nahi agar flex-direction: column hai */
}
.chat-controls {
    display: flex;
    justify-content: space-between;
    width: 100%; /* Controls row ko poori chaurai den */
    gap: 8px;
    align-items: center;
    margin-top: -5px; /* Thoda uper kar den */
}
/* **END FIXED CSS** */

.send-btn { 
/* ... (Remaining styles below) ... */
/* ========================================= */
/* Chat Box Styles (Common for Admin & Employee) */
/* ========================================= */
.chat-container {
    width: 350px;
    height: 500px; /* Ya apni marzi ki height */
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}
/* ... (Chat Header, Messages Box etc. unchanged) ... */

/* --- FIX for Chat Form Layout (Textarea and Controls) --- */
.chat-form {
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
    /* Main change: Set direction to column so elements stack */
    display: flex; 
    flex-direction: column; 
    gap: 8px; /* Elements ke darmiyan space */
}

.chat-form textarea {
    width: 100%; /* Full width */
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    resize: vertical; /* Allow vertical resizing, not horizontal */
    margin-bottom: 0; /* Remove extra margin */
    box-sizing: border-box;
    min-height: 50px; /* Textarea ki height barhayen */
}

/* New: Controls ko ek row mein rakhein */
.send-options {
    width: 100%; /* Full width */
    display: flex;
    justify-content: space-between; /* File input aur button ko alag karein */
    align-items: center;
    gap: 10px;
}

.send-options input[type="file"] {
    flex-grow: 1;
    font-size: 14px; /* Font size thora barha diya */
}

.send-btn {
    /* ... (Button styles unchanged) ... */
    padding: 8px 15px; 
}
/* --- END FIX --- */
/* style.css میں یہ اضافہ کریں */

/* Responsive improvements */
@media (max-width: 768px) {
    .monitoring-table {
        font-size: 0.9rem;
    }
    
    .monitoring-table th,
    .monitoring-table td {
        padding: 0.7rem 0.5rem;
    }
    
    .screen-preview {
        width: 80px;
        height: 60px;
    }
    
    .chat-button {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Loading animations */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 10px);
}

/* Print styles */
@media print {
    .chat-container,
    .logout-btn,
    .refresh-btn {
        display: none !important;
    }
}

/* Footer Styles */
footer {
    background: var(--dark);
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    border-radius: var(--border-radius);
    margin: 2rem 1.5rem 1.5rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.8;
}

.powered-by {
    font-size: 0.9rem;
    opacity: 0.8;
}

.powered-by a {
    color: var(--success);
    text-decoration: none;
    transition: var(--transition);
}

.powered-by a:hover {
    color: white;
    text-decoration: underline;
}

/* Responsive footer */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}