/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

:root {
    --bg-color: #07080e;
    --card-bg: rgba(20, 24, 40, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(255, 255, 255, 0.18);
    
    --text-primary: #f1f3f9;
    --text-secondary: #9aa2b5;
    --text-muted: #626b7f;
    
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.4);
    --accent-light: #a78bfa;
    
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.4);
    
    --green: #10b981;
    --green-glow: rgba(16, 185, 129, 0.3);
    
    --pink: #ec4899;
    --pink-glow: rgba(236, 72, 153, 0.3);
    
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.3);
    
    --blur-intensity: 16px;
    --transition-speed: 0.3s;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Ornamentations */
.glass-bg-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 1.5rem;
    z-index: 1;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.25;
    pointer-events: none;
}

.bubble-1 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    top: -100px;
    left: -100px;
    animation: pulse 12s infinite alternate;
}

.bubble-2 {
    width: 500px;
    height: 500px;
    background: var(--cyan);
    bottom: -150px;
    right: -100px;
    animation: pulse 15s infinite alternate-reverse;
}

.bubble-3 {
    width: 300px;
    height: 300px;
    background: var(--pink);
    top: 30%;
    left: 60%;
    animation: pulse 18s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(50px, 30px); }
}

/* Layout */
.app-layout {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Glassmorphism Common Styles */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: border var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.glass-card:hover {
    border-color: var(--card-hover-border);
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-icon {
    font-size: 1.75rem;
    color: var(--accent-light);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.text-accent {
    background: linear-gradient(135deg, var(--accent-light), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.system-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Stats Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
}

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

.icon-purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-light);
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

.icon-green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.icon-cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.icon-pink {
    background: rgba(236, 72, 153, 0.15);
    color: var(--pink);
    border: 1px solid rgba(236, 72, 153, 0.3);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.15);
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-info p {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Dashboard Panels Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.dashboard-panel {
    display: flex;
    flex-direction: column;
    padding: 1.75rem;
    min-height: 500px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-header h2 i {
    color: var(--accent-light);
}

/* Custom Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
    box-shadow: 0 0 15px var(--red-glow);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    padding: 0;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Glassmorphism Tables */
.table-responsive {
    overflow-x: auto;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.glass-table th, .glass-table td {
    padding: 1rem;
    vertical-align: middle;
}

.glass-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-table td {
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

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

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

/* Badges & Status */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: #cffafe;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-secondary {
    background: rgba(98, 107, 127, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(98, 107, 127, 0.3);
}

/* Action Button Groups */
.action-buttons {
    display: flex;
    gap: 0.4rem;
}

/* Active Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--green);
    box-shadow: 0 0 10px var(--green-glow);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Custom Multiline text formatter in tables */
.keyword-cell, .target-cell {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary) !important;
}

.keyword-cell span, .target-cell span {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin: 1px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Log Entries */
.log-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.log-item {
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color 0.2s ease;
}

.log-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

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

.log-job-name {
    font-weight: 600;
    font-size: 0.95rem;
}

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

.log-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.log-error {
    font-family: monospace;
    font-size: 0.8rem;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.15);
    margin-top: 0.25rem;
    word-break: break-all;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 4, 8, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 650px;
    padding: 2rem;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.2s;
}

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

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 576px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.text-danger {
    color: var(--red);
}

input[type="text"], input[type="number"], select, textarea {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

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

.checkbox-group {
    flex-direction: row;
    align-items: center;
    height: 100%;
    padding-top: 1.5rem;
}

.toggle-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Toast System */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    min-width: 300px;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgba(20, 24, 40, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid var(--green);
}

.toast-success i {
    color: var(--green);
}

.toast-error {
    border-left: 4px solid var(--red);
}

.toast-error i {
    color: var(--red);
}

.toast-info {
    border-left: 4px solid var(--cyan);
}

.toast-info i {
    color: var(--cyan);
}

.toast-content {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Helper Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.p-4 { padding: 1.5rem; }
