/* Modern Dark Mode & Glassmorphism Design System */
:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(26, 34, 53, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(59, 130, 246, 0.3);

    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --accent-purple: #8b5cf6;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', sans-serif;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Ambient Glow Background */
.glow-bg {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.1) 40%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
    position: relative;
    z-index: 1;
}

/* Header Component */
.header-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

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

/* Badges */
.badge {
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.badge-online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-offline {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border-color: rgba(244, 63, 94, 0.3);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 8px currentColor;
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: #fff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    color: #fff;
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-amber), #d97706);
    color: #fff;
}

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

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-blue);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.07);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.15));
    border-color: var(--accent-blue);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
}

/* Tab Contents */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards & Grid Layouts */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 2px 0;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* Banners */
.banner {
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.banner-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.banner-icon {
    font-size: 24px;
}

.banner-text {
    flex: 1;
}

.banner-text h4 {
    font-size: 15px;
    font-weight: 600;
}

.banner-text p {
    font-size: 13px;
    opacity: 0.9;
}

/* Section Header & Grid */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
}

.section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

/* Search Bar */
.search-bar {
    position: relative;
    padding: 12px 16px;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    padding-left: 32px;
}

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

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.custom-table th {
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

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

.text-right { text-align: right; }
.text-center { text-align: center; }

/* Alerts Grid */
.alerts-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.alert-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-rose);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}

.alert-card:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
}

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

.alert-matches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-kw {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.alert-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.alert-body {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    color: #e5e7eb;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 16px;
}

.modal-card {
    background: #111827;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.close-btn:hover { color: #fff; }

.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group input, .input-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: var(--font-main);
}

.input-group input:focus, .input-group textarea:focus {
    border-color: var(--accent-blue);
}

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

.toast {
    background: #1f2937;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s ease;
}

.toast-success { border-left: 4px solid var(--accent-emerald); }
.toast-error { border-left: 4px solid var(--accent-rose); }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }
.mt-3 { margin-top: 12px; }

/* Code tags */
code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--accent-amber);
}

/* Rules List */
.rules-list {
    list-style: none;
    font-size: 13px;
    color: var(--text-secondary);
}

.rules-list li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
