@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css");

:root {
    --bg-dark: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #cbd5e1;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --shadow-premium: 0 4px 20px 0 rgba(0, 0, 0, 0.05);

    --sidebar-bg: #f8fafc;
    --sidebar-border: #cbd5e1;
    --sidebar-text: #475569;
    --sidebar-text-hover: #1e293b;
    --sidebar-link-hover-bg: #e2e8f0;
    --sidebar-link-active-bg: rgba(37, 99, 235, 0.08);
    --sidebar-link-active-text: #2563eb;
}

html, body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Cairo', 'Outfit', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    direction: rtl; /* RTL by default for Arabic app */
    text-align: right;
}

/* RTL Adjustments for Bootstrap layout elements */
.nav {
    padding-right: 0;
}

.content {
    padding: 2rem;
}

a, .btn-link {
    color: var(--accent-hover);
    text-decoration: none;
}

a:hover {
    color: #60a5fa;
}

/* Glassmorphism Cards */
.card-premium {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Form Styling */
.form-label {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.text-muted {
    color: #64748b !important;
}

.form-control, .form-select {
    background-color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    padding: 10px 14px;
    transition: all 0.2s ease;
}

.form-control::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

.form-control:focus, .form-select:focus {
    background-color: #ffffff !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
    color: var(--text-primary) !important;
}

/* Button Styling */
.btn-premium {
    background-color: var(--accent-color);
    border: none;
    color: white;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-premium:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-premium:disabled {
    background-color: #cbd5e1 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-premium-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

.btn-premium-danger {
    background-color: var(--danger-color);
    border: none;
    color: white;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-premium-danger:hover {
    background-color: #f87171;
}

/* Status Badges */
.badge-premium {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

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

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

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

/* Custom Table */
.table-premium {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
}

.table-premium th {
    background-color: rgba(15, 23, 42, 0.5);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.table-premium td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.table-premium tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

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

.stat-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

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

/* Logs Console */
.log-console {
    background-color: #05070c;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Outfit', monospace;
    font-size: 0.9rem;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    color: #e5e7eb;
    direction: ltr; /* Console logs are LTR */
    text-align: left;
}

.log-entry {
    margin-bottom: 4px;
    word-break: break-all;
}

.log-entry.info { color: #38bdf8; }
.log-entry.warn { color: #facc15; }
.log-entry.error { color: #f87171; }
.log-entry.success { color: #4ade80; }

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

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

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

/* Sidebar overrides */
.sidebar {
    background-color: var(--sidebar-bg) !important;
    background-image: none !important;
    border-left: 1px solid var(--sidebar-border);
}

/* RTL Select Dropdown Arrow Fix */
.form-select {
    background-position: left 0.75rem center !important;
    padding-left: 2.5rem !important;
    padding-right: 14px !important;
}