:root {
    --bg-color: #121212;
    --sidebar-bg: #1a1a1a;
    --card-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #bb86fc;
    --accent-hover: #9965f4;
    --success: #03dac6;
    --error: #cf6679;
    --warning: #f1c40f;
    --border: #333;
    --bs-heading-color: #c2cdd0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

/* Sidebar Desktop Width */
@media (min-width: 768px) {
    .sidebar-wrapper {
        width: 260px;
        flex-shrink: 0;
    }
}

/* Sidebar Nav */
.sidebar nav li {
    cursor: pointer;
    margin-bottom: 5px;
}

/* Matches app.js active class toggling on LI */
.sidebar nav li.active .nav-link {
    background: rgba(187, 134, 252, 0.15);
    color: var(--accent) !important;
    border-radius: 6px;
    font-weight: 600;
}

.sidebar nav li:hover .nav-link {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

/* Content Area */
.content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 20px;
}

@media (max-width: 768px) {
    .content {
        padding: 15px;
        height: calc(100vh - 60px);
        /* Adjust for navbar */
    }
}

/* Card Styles */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    height: 100%;
}

/* Tables */
.table-responsive {
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

th {
    background: #252525;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* Status Badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-block;
}

.status-UP,
.status-VALID {
    color: var(--success);
    background: rgba(3, 218, 198, 0.1);
}

.status-DOWN,
.status-EXPIRED,
.status-ERROR {
    color: var(--error);
    background: rgba(207, 102, 121, 0.1);
}

.status-WARNING {
    color: var(--warning);
    background: rgba(241, 196, 15, 0.1);
}

/* Monitor List Responsive */
.monitor-row {
    background: var(--card-bg) !important;
    /* Force overrides */
}

@media (max-width: 768px) {
    .monitor-row {
        flex-direction: column;
        align-items: flex-start !important;
    }

    /* Select direct children divs of monitor row */
    .monitor-row>div {
        width: 100% !important;
        margin-bottom: 12px;
        text-align: left !important;
        padding: 0 !important;
        /* Reset padding if specific */
    }

    /* Restore visual bar width */
    .monitor-row>div:nth-child(2) {
        margin: 15px 0;
    }

    /* Hide specific details if too cramped? No, stack them */
}

/* Action Menu */
.action-menu {
    background: #252525;
    border: 1px solid #555;
    position: absolute;
    z-index: 1050;
    right: 0;
    border-radius: 6px;
    overflow: hidden;
}

.action-menu div {
    padding: 8px 16px;
    cursor: pointer;
    color: #ddd;
}

.action-menu div:hover {
    background: #333;
    color: #fff;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Forms & Inputs Global Styles */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input,
select,
textarea {
    background-color: #252525;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 15px;
    border-radius: 6px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 1rem;
}

input::placeholder {
    color: var(--text-secondary);
    opacity: 1;
}

/* Date inputs look like placeholders when empty */
input[type="datetime-local"] {
    color: var(--text-secondary);
}

/* When date is selected (handled by JS class) */
input[type="datetime-local"].has-value {
    color: var(--text-primary);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(187, 134, 252, 0.2);
}

/* Button Overrides */
.btn-primary {
    background-color: #C084FC !important;
    border-color: #C084FC !important;
    color: #000 !important;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    /* Rounded corners */
    transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
    background-color: #A76EE0 !important;
    border-color: #A76EE0 !important;
    box-shadow: 0 4px 12px rgba(192, 132, 252, 0.4);
}

.btn-outline-secondary {
    color: #ccc;
    border-color: #555;
    border-radius: 8px;
}

.btn-outline-secondary:hover {
    background-color: #333;
    color: #fff;
    border-color: #777;
}

.btn-outline-danger {
    border-radius: 8px;
}

/* Custom outline class if used elsewhere */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: center;
    display: inline-block;
    font-weight: 600;
}

.btn-outline:hover {
    border-color: #C084FC;
    color: #C084FC;
    background: rgba(192, 132, 252, 0.1);
}

/* Modal Overlay */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    /* .hidden rule overrides display to none */
}

/* Modal Dark Theme Fixes */
.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
}

.close {
    color: var(--text-secondary);
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
    opacity: 0.7;
}

.close:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* Action Buttons */
.action-buttons-group {
    display: flex;
    gap: 8px;
    /* Spacing between buttons as requested */
    justify-content: flex-end;
}

.btn-action {
    border: none;
    padding: 6px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 2px;
    /* Less rounded as per image */
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-action:hover {
    opacity: 0.9;
}

.btn-action-stats {
    background-color: #6200EA;
    /* Deep Purple */
    color: white;
}

.btn-action-refresh {
    background-color: #FFFFFF;
    color: black;
    border: 1px solid #ccc;
}

.btn-action-del {
    background-color: #FFFFFF;
    color: black;
    border: 1px solid #ccc;
}

/* Log Viewer */
.log-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 16px;
    margin-bottom: 12px;
}

.log-command {
    color: #e1e1e1;
    font-size: 0.95rem;
}

.log-command .message-text {
    cursor: pointer;
    text-decoration: underline dotted;
    display: block;
    max-height: 2.8em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.log-command .message-text.expanded {
    max-height: none;
    white-space: normal;
    text-overflow: unset;
}

.log-meta {
    color: #888;
    font-size: 0.85rem;
}

.chip {
    background: #252525;
    border: 1px solid #444;
    color: #ddd;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chip.active {
    background: rgba(187, 134, 252, 0.15);
    border-color: #bb86fc;
    color: #bb86fc;
    box-shadow: 0 0 8px rgba(187, 134, 252, 0.4);
}
