/* ================= BODY & RESET ================= */
* {
    box-sizing: border-box; /* Ensures padding doesn't break column widths */
}

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    background: #f5f6fa;
    font-size: 14px;
    color: #333;
}

/* ================= HEADER ================= */
.header {
    background: #1f2d3d;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title {
    font-size: 20px;
    font-weight: bold;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.username {
    font-weight: bold;
}

.logout {
    color: white;
    text-decoration: none;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
}

.logout:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ================= TABS ================= */
.tabs {
    display: flex;
    background: #3a4b63;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    color: white;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s;
}

.tab:hover {
    background: #4a5b73;
}

.tab.active {
    background: #f39c12;
}

/* ================= CONTENT & CONTROLS ================= */
.container {
    padding: 20px;
}

.controls {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

input#searchInput {
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 220px;
}

/* Original Refresh Button Style */
.refresh-btn {
    padding: 6px 12px;
    cursor: pointer;
    border: 1px solid #ccc;
    background: #e0e0e0;
    color: #333;
    border-radius: 4px;
    font-size: 14px;
    font-weight: normal;
}

.refresh-btn:hover {
    background: #d0d0d0;
}

/* ================= TABLE (FIXED ALIGNMENT) ================= */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: fixed; /* Critical for keeping widths exact */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

th {
    padding: 12px;
    border-bottom: 2px solid #ddd;
    font-size: 15px;
    font-weight: bold;
    color: #333;
    background: #fff;
}

td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
    font-size: 14px;
}

/* Column 1: Name (Left-Aligned) */
th:nth-child(1), td:nth-child(1) { 
    width: 50%; 
    text-align: left; 
}

/* Column 2: Status (Center-Aligned) */
th:nth-child(2), td:nth-child(2) { 
    width: 25%; 
    text-align: center; 
}

/* Column 3: Action (Center-Aligned) */
th:nth-child(3), td:nth-child(3) { 
    width: 25%; 
    text-align: center; 
}

tr:hover {
    background: #f9f9f9;
}

/* ================= STATUS LAYOUT & SPINNER ================= */
/* Wrapper to keep the Spinner + Text aligned horizontally and centered */
.status-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

/* The Circular Buffer Circle */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top: 2px solid #f39c12; /* Orange spinning segment */
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0; /* Prevents spinner from squishing */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================= STATUS COLORS ================= */
.green { color: #27ae60 !important; font-weight: bold; }
.red { color: #c0392b !important; font-weight: bold; }
.orange { color: #f39c12 !important; font-weight: bold; }

/* ================= BUTTONS (START/STOP) ================= */
button.start-btn, button.stop-btn {
    padding: 5px 12px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    margin: 0 2px;
    display: inline-block;
}

button.start-btn:hover:not(:disabled), 
button.stop-btn:hover:not(:disabled) {
    background: #f4f4f4;
    border-color: #bbb;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ================= ACTIVITY TABLE OVERRIDES ================= */
.activity-table th:nth-child(1), 
.activity-table td:nth-child(1) { width: 20% !important; text-align: left; }

.activity-table th:nth-child(2), 
.activity-table td:nth-child(2) { width: 20% !important; text-align: center; }

.activity-table th:nth-child(3), 
.activity-table td:nth-child(3) { width: 20% !important; text-align: center; }

.activity-table th:nth-child(4), 
.activity-table td:nth-child(4) { width: 40% !important; text-align: left; }