:root {
    /* Color Palette */
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #64748b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;

    --border-color: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Typography Utilities */
h1,
h2,
h3 {
    font-weight: 600;
}

.text-error {
    color: var(--error);
}

.text-success {
    color: var(--success);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
}

/* Glassmorphism */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 32px;
}

.logo-icon {
    font-size: 24px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.trigger-checks {
    margin-top: auto;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.trigger-checks:hover {
    background: var(--success);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 0;
    /* sidebar removed */
    padding: 24px 40px;
    min-width: 0;
    /* prevents flex child from overflowing parent */
    max-width: 100vw;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    width: 300px;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    width: 100%;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

/* View System */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.view-section.active {
    display: block;
}

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

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: var(--error-bg);
    color: var(--error);
    padding: 6px 12px;
    font-size: 14px;
}

.btn-danger:hover {
    background: var(--error);
    color: white;
}

.btn-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 6px 12px;
    font-size: 14px;
}

.btn-warning:hover {
    background: var(--warning);
    color: white;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.website-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.vps-icon {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.ok-icon {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.error-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

/* Tables */
.table-container {
    padding: 0;
    overflow: visible; /* Changed from hidden to allow sticky header */
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 8px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #1e293b; /* Solid background to prevent text overlap */
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.3); /* subtle shadow below header */
}

.sort-icon {
    font-size: 12px;
    margin-left: 6px;
    opacity: 0.3;
    transition: opacity 0.2s, color 0.2s;
}

.data-table th:hover .sort-icon {
    opacity: 0.8;
    color: var(--primary);
}

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

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

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

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 32px;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.show {
    display: flex;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.row-group {
    display: flex;
    gap: 16px;
}

.col {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out forwards;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

/* Mobile & Responsive Support */
@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .top-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-bottom: 24px;
    }

    .top-header>div:last-child {
        flex-wrap: wrap;
        width: 100%;
        justify-content: space-between;
    }

    .search-bar {
        width: 100%;
        order: 2;
    }

    .trigger-checks {
        order: 1;
        flex: 1;
        justify-content: center;
    }

    .user-profile {
        order: 1;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 24px;
    }

    .stat-card {
        padding: 16px;
        gap: 12px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 12px;
    }

    .stat-info h3 {
        font-size: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .section-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .section-header h1 {
        font-size: 22px;
    }

    .section-header h2 {
        font-size: 18px;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        margin-bottom: 16px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 12px;
    }

    .data-table td {
        text-align: right;
        padding-left: 45%;
        position: relative;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: flex-end;
        align-items: center;
        min-height: 48px;
        font-size: 14px;
        white-space: normal;
        word-break: break-all;
    }

    .data-table td:last-child {
        border-bottom: 0;
    }

    .data-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 40%;
        padding-left: 12px;
        font-weight: 600;
        text-align: left;
        color: var(--text-muted);
    }

    .table-container {
        overflow-x: visible;
        background: transparent;
        box-shadow: none;
        border: none;
    }

    .row-group {
        flex-direction: column;
        gap: 12px;
    }

    .modal-content {
        padding: 20px;
        width: 92%;
    }

    #toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }

    .toast {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        padding: 12px;
        gap: 8px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .stat-value {
        font-size: 18px;
    }
}