* {
    box-sizing: border-box;
}

html {
    margin: 1rem;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: #e0e0e0;
    min-height: 100vh;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 40px;
    box-sizing: border-box;
}

h1 {
    color: #fff;
    margin-bottom: 30px;
    font-weight: 500;
    font-size: 2em;
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9em;
    white-space: nowrap;
    color: white;
}

#statusTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #2a2a2a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#statusTable th,
#statusTable td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #3a3a3a;
    white-space: nowrap;
}

#statusTable th {
    background-color: #333;
    color: #e0e0e0;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

#statusTable tr:last-child td {
    border-bottom: none;
}

#statusTable tr:hover {
    background-color: #333;
}

#statusTable td:first-child,
#statusTable th:first-child {
    padding-left: 24px;
}

#statusTable td:last-child,
#statusTable th:last-child {
    padding-right: 24px;
}

#statusTable .actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

#statusTable .actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9em;
    white-space: nowrap;
    color: white;
}

#statusTable .actions .toggle.btn {
    background-color: #43a047;
}

#statusTable .actions .toggle.btn:hover {
    background-color: #2e7d32;
}

#statusTable .actions .edit.btn {
    background-color: #1e88e5;
}

#statusTable .actions .edit.btn:hover {
    background-color: #1565c0;
}

#statusTable .actions .delete.btn {
    background-color: #e53935;
}

#statusTable .actions .delete.btn:hover {
    background-color: #c62828;
}

#statusTable .actions .screenshot.btn {
    background-color: #1e88e5;
}

#statusTable .actions .screenshot.btn:hover {
    background-color: #1565c0;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95em;
    font-weight: 500;
}

.status-active {
    background-color: #2e7d32;
    color: #fff;
}

.status-inactive {
    background-color: #c62828;
    color: #fff;
}

.action-button {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-right: 10px;
    min-width: 120px;
}

/* Safe actions - Green */
.add-btn,
.submit-btn,
.alert-ok-btn {
    background-color: #4caf50 !important;
    color: white !important;
    padding: 10px 20px !important;
    font-size: 1.1em !important;
}

.add-btn:hover,
.submit-btn:hover,
.alert-ok-btn:hover {
    background-color: #388e3c !important;
}

/* Toggle button - Green when disabled, Red when enabled */
button[onclick^="toggleActive"] {
    padding: 10px 20px !important;
    font-size: 1.1em !important;
    color: white !important;
}

button[onclick^="toggleActive"]:not(.active) {
    background-color: #4caf50 !important;
}

button[onclick^="toggleActive"]:not(.active):hover {
    background-color: #388e3c !important;
}

button[onclick^="toggleActive"].active {
    background-color: #f44336 !important;
}

button[onclick^="toggleActive"].active:hover {
    background-color: #d32f2f !important;
}

/* Dangerous actions - Red */
.delete-btn,
.alert-cancel-btn {
    background-color: #f44336 !important;
    color: white !important;
    padding: 10px 20px !important;
    font-size: 1.1em !important;
}

.delete-btn:hover,
.alert-cancel-btn:hover {
    background-color: #d32f2f !important;
}

/* Neutral actions - Blue */
.edit-btn,
.screenshot-btn {
    background-color: #2196f3 !important;
    color: white !important;
    padding: 10px 20px !important;
    font-size: 1.1em !important;
}

.edit-btn:hover,
.screenshot-btn:hover {
    background-color: #1976d2 !important;
}

.add-button {
    background-color: #43a047;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 30px;
}

.add-button:hover {
    background-color: #2e7d32;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: #2a2a2a;
    margin: 40px auto;
    padding: 40px;
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    width: 100%;
    justify-content: start;
}

.col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.modal-form .form-group {
    margin-bottom: 0;
    width: 100%;
}

.modal-form .form-group.full-width {
    grid-column: 1 / -1;
    margin-top: 20px;
}

.modal-form h3 {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 500;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

/* Toggle switch styling */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-bottom: 0.5em;
}

.toggle-label {
    display: flex;
    flex-direction: row;
    width: 100%;
    align-items: center;
    gap: 0.5em;
    font-weight: 500;
    cursor: pointer;
    color: #e0e0e0;
    margin-bottom: 0;
    font-size: 1em;
    line-height: 1.2;
}

.toggle-group>.toggle-label>.toggle-slider {
    margin-left: 0.5em;
    margin-top: 0;
    margin-bottom: 0;
}

.toggle-group input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 70px;
    height: 28px;
    border-radius: 14px;
    background-color: #d32f2f;
    transition: background-color 0.3s;
    margin-left: 0.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.toggle-group input[type="checkbox"]:checked+.toggle-slider {
    background-color: #4caf50;
}

.toggle-slider .toggle-text {
    position: absolute;
    top: 0;
    width: 32px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
    user-select: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 3;
    pointer-events: none;
}

.toggle-slider .toggle-off {
    left: 4px;
}

.toggle-slider .toggle-on {
    right: 4px;
}

.toggle-group input[type="checkbox"]:not(:checked)+.toggle-slider .toggle-off {
    opacity: 1;
}

.toggle-group input[type="checkbox"]:checked+.toggle-slider .toggle-on {
    opacity: 1;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    top: 4px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.3s;
    z-index: 2;
}

.toggle-label input[type="checkbox"]:not(:checked)+.toggle-slider:before {
    left: 44px;
    /* Knob on right when OFF */
}

.toggle-label input[type="checkbox"]:checked+.toggle-slider:before {
    left: 4px;
    /* Knob on left when ON */
}

.toggle-switch {
    display: flex;
    align-items: start;
}

.modal-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #444;
    border-radius: 6px;
    background-color: #333;
    color: #fff;
    font-size: 16px;
    box-sizing: border-box;
}

.modal-form input:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.2);
}

.modal-form label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-weight: 500;
}

.close-button {
    position: absolute;
    right: 30px;
    top: 30px;
    font-size: 28px;
    cursor: pointer;
    color: #e0e0e0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    background-color: #333;
}

.close-button:hover {
    color: #fff;
    background-color: #444;
}

.submit-button {
    background-color: #43a047;
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 20px;
}

.submit-button:hover {
    background-color: #2e7d32;
}

.alert-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
}

.alert-content {
    background-color: #2a2a2a;
    margin: 40px auto;
    padding: 40px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.alert-message {
    margin-bottom: 30px;
    color: #e0e0e0;
    font-size: 1.2em;
    line-height: 1.5;
}

.alert-buttons {
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.alert-button {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 100px;
}

.alert-ok-button {
    background-color: #43a047;
    color: white;
}

.alert-ok-button:hover {
    background-color: #2e7d32;
}

.alert-cancel-button {
    background-color: #e53935;
    color: white;
}

.alert-cancel-button:hover {
    background-color: #c62828;
}

/* Screenshot preview styles */
.screenshot-preview {
    width: 200px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 2px solid #3a3a3a;
    background-color: #1a1a1a;
}

.screenshot-preview:hover {
    transform: scale(1.05);
    border-color: #1e88e5;
}

.screenshot-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    margin-top: 20px;
}

.screenshot-box {
    background-color: #333;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    flex: 0 0 360px; /* fixed width to avoid wrap on small width changes */
    width: 360px;
}

.screenshot-timestamp {
    font-size: 0.9em;
    color: #bdbdbd;
    margin-top: 10px;
}

.screenshot-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.fullscreen-modal .modal-content {
    width: 95%;
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
}

.fullscreen-modal img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
}

.screenshot-caption {
    font-size: 0.9em;
    color: #bdbdbd;
    margin-top: 10px;
    font-style: italic;
}

.btn-green {
    background-color: #27ae60;
    color: #fff;
    border: none;
    transition: background 0.2s;
}

.btn-green:hover,
.btn-green:focus {
    background-color: #219150;
}

.btn-red {
    background-color: #e74c3c;
    color: #fff;
    border: none;
    transition: background 0.2s;
}

.btn-red:hover,
.btn-red:focus {
    background-color: #c0392b;
}

.btn-blue {
    background-color: #2980b9;
    color: #fff;
    border: none;
    transition: background 0.2s;
}

.btn-blue:hover,
.btn-blue:focus {
    background-color: #1565c0 !important;
}

/* Spinner Overlay */
.spinner-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.spinner-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background-color: #2a2a2a;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid #3a3a3a;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #3a3a3a;
    border-top: 4px solid #1e88e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.spinner-text {
    color: #e0e0e0;
    font-size: 1.1em;
    font-weight: 500;
    margin-top: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Monitoring status styles */
.monitoring-status {
    font-size: 0.85em;
    line-height: 1.4;
}

.monitoring-enabled {
    color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #4CAF50;
}

.monitoring-disabled {
    color: #888;
    background-color: rgba(136, 136, 136, 0.1);
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #888;
}

.monitoring-enabled strong {
    color: #66BB6A;
}

.monitoring-enabled small,
.monitoring-disabled small {
    display: block;
    margin-top: 2px;
    opacity: 0.9;
}