body {
    margin: 0;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background-color: #4a4a4a;
    color: #e0e0e0;
    display: flex;
    height: 100vh;
    overflow: hidden; /* Prevent body scroll */
}

.container {
    display: flex;
    width: 100%;
}

/* Left Menu */
.left-menu {
    width: 200px;
    background-color: #3c3c3c;
    border-right: 1px solid #2a2a2a;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
}

.menu-button {
    text-align: left;
    padding: 12px 20px;
    border: none;
    background: none;
    color: #cccccc;
    font-size: 14px;
    border-radius: 5px;
    margin: 5px 10px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-weight: bold;
}

.menu-button:hover {
    background-color: #5a5a5a;
    color: #ffffff;
}

.menu-button.active {
    background-color: #0078d7;
    color: #ffffff;
}

/* Right Panel */
.right-panel {
    flex-grow: 1;
    background-color: #4a4a4a;
    padding: 20px;
    overflow-y: auto; /* Allow scrolling for content */
}

h2 {
    font-size: 24px;
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 20px;
}

h3 {
    font-size: 18px;
    font-weight: bold;
    color: #e0e0e0;
    margin-top: 20px;
    margin-bottom: 10px;
}

/* Tab Content */
.tab-content {
    display: none;
    height: 100%; /* Take full height of parent */
    padding-bottom: 20px; /* Space for content below scroll */
}

.tab-content.active {
    display: block;
}

/* Form Elements */
input[type="text"],
input[type="number"],
select,
textarea {
    background-color: #5f5f5f;
    color: #e0e0e0;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box; /* Include padding in width */
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: #0078d7;
    outline: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

button {
    background-color: #5f5f5f;
    border: 1px solid #3c3c3c;
    border-radius: 5px;
    padding: 10px 15px; /* Немного уменьшил padding */
    font-weight: bold;
    color: #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #6a6a6a;
}

button:active {
    background-color: #555555;
}

/* For small buttons like uninstall */
.small-button {
    padding: 5px 10px; /* Меньший padding для кнопок в таблице */
    font-size: 12px;
}

/* Tables */
.table-container {
    overflow-x: auto; /* Enable horizontal scrolling for wide tables */
    margin-bottom: 20px;
    background-color: #5f5f5f; /* Background for the table itself */
    border-radius: 8px;
    border: 1px solid #6a6a6a;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px; /* Ensure table doesn't get too narrow */
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #4a4a4a;
}

thead th {
    background-color: #5f5f5f;
    color: #e0e0e0;
    font-weight: bold;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    position: sticky; /* Make header sticky when scrolling */
    top: 0;
    z-index: 1; /* Ensure header stays above content */
}

tbody tr:hover {
    background-color: #6a6a6a;
}

td {
    background-color: #5f5f5f; /* Cell background */
    color: #e0e0e0;
}

/* Specific table styling from PyQt */
.status-online {
    background-color: #28a745; /* Green */
    color: white;
    text-align: center;
}

.status-offline {
    background-color: #dc3545; /* Red */
    color: white;
    text-align: center;
}

.admin-yes {
    background-color: #2ecc71; /* Another shade of green */
    color: white;
    text-align: center;
}

.admin-no { /* Optional: for admin NO */
    background-color: #ffc107; /* Yellowish */
    color: #343a40;
    text-align: center;
}

/* Checkbox */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
    appearance: none; /* Hide default checkbox */
    -webkit-appearance: none; /* For Safari */
    border: 1px solid #777;
    border-radius: 3px;
    background-color: #5f5f5f;
    cursor: pointer;
    position: relative; /* For custom checkmark */
    flex-shrink: 0; /* Prevent checkbox from shrinking */
}

input[type="checkbox"]:checked {
    background-color: #0078d7;
    border-color: #005a9e;
}

input[type="checkbox"]:checked::after {
    content: '✔';
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.select-all-container {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

/* --- TASKS TAB SPECIFIC STYLES --- */
.tasks-clients-section {
    flex-grow: 1; /* Allows it to take up available space */
    display: flex;
    flex-direction: column;
    height: 60vh; /* Make this section tall, allowing more space for clients */
}

.tasks-clients-list {
    flex-grow: 1; /* Makes the list take up remaining space in the section */
    overflow-y: auto;
    border: 1px solid #6a6a6a;
    border-radius: 5px;
    padding: 10px;
    background-color: #5f5f5f;
    margin-bottom: 15px; /* Reduced margin to pull up task config */
}

.task-client-item { /* New class for individual client checkbox container */
    display: flex; /* Use flexbox for label and checkbox alignment */
    align-items: center; /* Vertically align items in the middle */
    padding: 5px 0;
}

.task-client-item label {
    margin-bottom: 0; /* Remove default label margin */
    flex-grow: 1; /* Allow label to take available space */
    margin-left: 5px; /* Add a small gap between checkbox and label text */
}


.task-config-section {
    padding-top: 15px;
    border-top: 1px solid #6a6a6a; /* Separator */
    margin-top: 15px; /* Space from client list */
}

/* Adjust form-group margin for compactness */
.task-config-section .form-group {
    margin-bottom: 10px; /* Reduced margin */
}

.task-config-section button {
    width: 100%; /* Make button full width */
    margin-top: 10px;
}

/* --- STATS TAB SPECIFIC STYLES --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Adjusted min-width for 3 columns */
    gap: 25px;
    margin-bottom: 25px; /* Space before the full-width card */
}

.stat-card {
    background-color: #5f5f5f;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #6a6a6a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Optional subtle shadow */
}

.stat-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    color: #e0e0e0;
}

.stat-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stat-card li {
    padding: 5px 0;
    border-bottom: 1px dashed #6a6a6a;
}

.stat-card li:last-child {
    border-bottom: none;
}

/* New style for the full-width stat card (for last installations) */
.stats-full-width-card {
    margin-top: 25px; /* Space from the grid above */
}

.stats-full-width-card .stat-card {
    /* Ensures it takes full width when in a separate div */
    width: auto;
}

.stat-card table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.stat-card th, .stat-card td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #4a4a4a;
}

.stat-card tbody tr:last-child td {
    border-bottom: none;
}

/* Utility for form groups */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

/* Stats Overview */
.stats-overview {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    gap: 20px;
}

.stat-box {
    background-color: #5f5f5f;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #6a6a6a;
    text-align: center;
    min-width: 150px;
    flex: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.stat-box h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    color: #e0e0e0;
}

.stat-box p {
    font-size: 36px;
    font-weight: bold;
    color: #0078d7; /* A contrasting color */
    margin: 0;
}