:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* App Container (Sidebar + Main) */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-icon {
    font-size: 1.2rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.1);
}

.user-info-mini {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-info-mini small {
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-connected {
    background: var(--success);
    color: #fff;
}

.status-disconnected {
    background: var(--danger);
    color: #fff;
}

.logout-btn-mini {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.logout-btn-mini:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* Main Content Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    background: var(--bg-primary);
}

/* View Section & Headers */
.view-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.view-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Filters Bar */
.filters-bar {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-group.grow {
    flex: 1;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.search-input,
.filter-select,
.filters-bar input[type="date"] {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    min-width: 150px;
}

.search-input {
    min-width: 200px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    padding-left: 2.25rem;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Stats Mini */
.stats-grid-mini {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 200px));
    gap: 1rem;
    margin-bottom: 2rem;
    /* Add spacing between stats and device list */
}

.stat-card-mini {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-card-mini .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-card-mini strong {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-card-mini.success strong {
    color: var(--success);
}

/* Devices List Grid */
.devices-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.device-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border);
}

.device-card.active::before {
    background: var(--success);
}

.device-card.offline::before {
    background: var(--text-muted);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-ip-badge {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: monospace;
}

.device-status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.device-status-badge.active {
    color: var(--success);
}

.device-status-badge.offline {
    color: var(--text-muted);
}

.device-name-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.btn-rename {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 0.5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-rename:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.device-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

/* Logs */
.log-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.log-entry {
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.log-entry.error {
    border-left-color: var(--danger);
}

.log-entry.connection {
    border-left-color: var(--success);
}

.log-entry.packet-out {
    border-left-color: var(--warning);
}

.log-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.log-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.log-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.log-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Common Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-send-request {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-send-request:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
}

.btn-send-request svg {
    transition: transform 0.2s ease;
}

.btn-send-request:hover svg {
    transform: translate(3px, -3px);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

/* API Tester Panel specific adjustments */
.panel.api-raw-panel-full {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.api-helpers {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.api-tester-container textarea {
    width: 100%;
    min-height: 200px;
    margin-bottom: 1rem;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    padding: 1rem;
}

.helper-group select,
.form-group select {
    width: 100%;
    padding: 0.6rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.api-response {
    margin-top: 1.5rem;
}

.response-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0.75rem;
    border: 1px dashed var(--border);
    color: var(--text-muted);
}

.response-content {
    background: #0f172a;
    /* Darker bg for code */
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    overflow: hidden;
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

#api-response-content {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.85rem;
    color: #a5b4fc;
    max-height: 400px;
    overflow-y: auto;
}

.helper-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* Configuration Panel Styles */
.config-panel {
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.config-panel label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.config-panel input[type="text"],
.config-panel input[type="password"] {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.config-panel input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 3rem;
    /* Space for toggle button */
}

.toggle-password {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0.7;
    transition: all 0.2s;
}

.toggle-password:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 1rem;
    }

    .nav-item {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 0.25rem;
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .nav-icon {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

    .nav-item span:last-child {
        display: none;
    }

    /* Hide text on mobile if needed or small */
    .main-content {
        padding: 1rem;
        overflow: visible;
    }
}

/* Utilities */
.password-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.password-input-wrapper input {
    flex: 1;
}

.toggle-password {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
}

.form-group input {
    width: 100%;
}

/* Toast */


/* Login Page Specifics - Glassmorphism & Animations */

.login-wrapper {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.shape {
    position: absolute;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite ease-in-out;
    opacity: 0.6;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(to right, var(--primary), #8B5CF6);
    top: -50px;
    left: -50px;
    border-radius: 50%;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(to right, var(--success), #34D399);
    bottom: -50px;
    right: -50px;
    border-radius: 50%;
    animation-delay: -2s;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(to right, var(--warning), #F59E0B);
    top: 40%;
    left: 40%;
    border-radius: 50%;
    animation-delay: -4s;
    opacity: 0.4;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, -30px) scale(1.1);
    }
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 1.5rem;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* Updated SVG Icon Styles */
.brand-icon-large {
    font-size: 0;
    /* Clear previous font size */
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
    animation: pulse 3s infinite ease-in-out;
}

.brand-icon-large svg {
    width: 64px;
    height: 64px;
    color: var(--primary-light);
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-group-lg {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    font-size: 0;
    position: absolute;
    left: 1rem;
    height: 100%;
    z-index: 10;
    opacity: 0.7;
    display: flex;
    align-items: center;
}

.input-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.input-group-lg input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.input-group-lg input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.toggle-password-login {
    position: absolute;
    right: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password-login svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.toggle-password-login:hover {
    opacity: 1;
}

.toggle-password-login:hover svg {
    color: var(--text-primary);
}

.btn-login {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

.btn-login.loading span {
    display: none;
}

.btn-login.loading .btn-spinner {
    display: block;
}

.btn-login.loading {
    cursor: not-allowed;
    opacity: 0.8;
}

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

.error-message {
    color: #f87171;
    font-size: 0.85rem;
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.5rem;
    border-radius: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    opacity: 0.6;
    font-size: 0.8rem;
}

/* Action Buttons (Header & Utility) */
.refresh-btn,
.clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
}

.refresh-btn:hover,
.clear-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-light);
    color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow);
}

.refresh-btn:active,
.clear-btn:active {
    transform: translateY(0);
}

/* Clear Button Specifics */
.clear-btn {
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
    color: var(--text-muted);
    border-color: transparent;
    background: transparent;
}

.clear-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    box-shadow: none;
}

/* Header Actions container adjustment */
.header-actions {
    align-items: center;
}

/* --- CRUD TABLE & PANEL STYLES --- */

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    text-align: left;
}

.data-table thead th {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
    padding: 1rem 1.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table td {
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
}

.btn-icon.danger:hover {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}


/* --- MODAL STYLES --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    animation: slideUpModal 0.3s ease-out;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.modal-body select {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--bg-primary);
    /* Slight contrast */
    border-radius: 0 0 1rem 1rem;
}

/* System Logs Table Styles */
.severity-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.severity-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.severity-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.severity-critical {
    background: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    animation: pulse-critical 2s infinite;
}

@keyframes pulse-critical {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.message-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#system-logs-table {
    width: 100%;
    font-size: 0.85rem;
}

#system-logs-table th,
#system-logs-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#system-logs-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

#system-logs-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.stat-card-mini.danger {
    border-left: 3px solid var(--danger);
}

.stat-card-mini.danger strong {
    color: var(--danger);
}

/* Pagination Buttons */
.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Actions cell for system logs */
#system-logs-table .btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

#system-logs-table .btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}
