/* Azovi Job Service - Modern Design System */

/* ============================================
   CSS VARIABLES & DESIGN TOKENS
   ============================================ */
:root {
    /* Monospace Typography Stack */
    --font-primary: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

    /* Color Palette - Deep Blues & Tech Accents */
    --color-primary: #00d4ff;
    --color-primary-dark: #00a8cc;
    --color-primary-light: #4de2ff;

    --color-secondary: #6366f1;
    --color-secondary-dark: #4f46e5;
    --color-secondary-light: #818cf8;

    --color-accent: #10b981;
    --color-accent-warn: #f59e0b;
    --color-accent-danger: #ef4444;

    /* Background Colors */
    --color-bg-primary: #0a0e27;
    --color-bg-secondary: #131730;
    --color-bg-tertiary: #1a1f3a;
    --color-bg-card: #1e2541;
    --color-bg-hover: #252b4a;

    /* Text Colors */
    --color-text-primary: #e2e8f0;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-text-inverse: #0f172a;

    /* Border & Divider */
    --color-border: #2d3551;
    --color-border-light: #3d4561;
    --color-divider: #252b4a;

    /* Status Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);

    /* Spacing Scale (8px base) */
    --space-1: 0.5rem;   /* 8px */
    --space-2: 1rem;     /* 16px */
    --space-3: 1.5rem;   /* 24px */
    --space-4: 2rem;     /* 32px */
    --space-5: 2.5rem;   /* 40px */
    --space-6: 3rem;     /* 48px */
    --space-8: 4rem;     /* 64px */

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;

    /* Z-index Scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ============================================
   GLOBAL RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

p {
    margin-bottom: var(--space-2);
    font-size: 0.95rem;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-light);
}

code {
    font-family: var(--font-primary);
    background: var(--color-bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--color-primary);
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.modern-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    padding: var(--space-2);
    z-index: var(--z-fixed);
    transition: all var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

.modern-sidebar.collapsed {
    width: 60px;
    padding-left: 0;
    padding-right: 0;
}

.modern-sidebar.collapsed .sidebar-brand-text,
.modern-sidebar.collapsed .sidebar-nav-link span:not(.sidebar-nav-icon) {
    display: none;
}

.modern-sidebar.collapsed .sidebar-brand {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
}

.modern-sidebar.collapsed .sidebar-nav-link {
    justify-content: center;
    gap: 0;
    padding-left: var(--space-2);
    padding-right: var(--space-2);
}

.sidebar-footer {
    position: absolute;
    bottom: var(--space-3);
    left: var(--space-3);
    right: var(--space-3);
}

.modern-sidebar.collapsed .sidebar-footer {
    left: 0;
    right: 0;
    text-align: center;
}

.modern-sidebar.collapsed .sidebar-footer > div {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Hide the second div (powered_by) completely */
.modern-sidebar.collapsed .sidebar-footer > div:last-child {
    display: none !important;
}

/* Hide the "system_status" span in first div */
.modern-sidebar.collapsed .sidebar-footer > div:first-child {
    margin-bottom: 0 !important;
}

.modern-sidebar.collapsed .sidebar-footer span:not(.status-dot),
.modern-sidebar.collapsed .sidebar-footer a {
    display: none;
}

.modern-sidebar.collapsed .sidebar-footer .status-dot {
    display: inline-block !important;
    width: 12px;
    height: 12px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.sidebar-brand:hover {
    opacity: 0.8;
}

.sidebar-collapse-btn {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    z-index: 10;
    color: var(--color-text-secondary);
}

.sidebar-collapse-btn:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.modern-sidebar.collapsed .sidebar-collapse-btn {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    top: 70px;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.sidebar-brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav-item {
    margin-bottom: var(--space-1);
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar-nav-link:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
    transform: translateX(4px);
}

.sidebar-nav-link.active {
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.1), transparent);
    color: var(--color-primary);
    border-left: 3px solid var(--color-primary);
}

/* Add visual separator for action items in nav */
.sidebar-nav-action {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

/* Hide border when collapsed */
.modern-sidebar.collapsed .sidebar-nav-action {
    border-top: none;
    padding-top: 0;
    margin-top: var(--space-2);
}

.sidebar-nav-icon {
    width: 20px;
    text-align: center;
}

/* ============================================
   TOP BAR
   ============================================ */
.modern-topbar {
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    height: 60px;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 0 var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: var(--z-sticky);
    transition: left var(--transition-base);
}

.modern-sidebar.collapsed ~ .modern-topbar {
    left: 60px;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.breadcrumb-link {
    color: var(--color-text-secondary);
    transition: color var(--transition-fast);
}

.breadcrumb-link:hover {
    color: var(--color-primary);
}

.breadcrumb-separator {
    margin: 0 var(--space-1);
    color: var(--color-text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-search {
    position: relative;
    width: 300px;
}

.topbar-search input {
    width: 100%;
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-5);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text-primary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

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

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.modern-main {
    margin-left: 240px;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
    padding: var(--space-3);
    transition: margin-left var(--transition-base);
}

.modern-sidebar.collapsed ~ * .modern-main,
.modern-sidebar.collapsed ~ .modern-main {
    margin-left: 60px;
}

/* ============================================
   CARDS
   ============================================ */
.modern-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.modern-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-border-light);
}

.modern-card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--color-divider);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.card-body {
    font-size: 0.85rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   METRIC CARDS
   ============================================ */
.metric-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1), transparent);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.metric-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1;
    margin-bottom: var(--space-1);
    font-variant-numeric: tabular-nums;
}

.metric-change {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.metric-change.positive {
    color: var(--color-success);
}

.metric-change.negative {
    color: var(--color-error);
}

.metric-icon {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    font-size: 1.5rem;
    opacity: 0.3;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-modern {
    font-family: var(--font-primary);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width var(--transition-base), height var(--transition-base);
}

.btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-border-light);
}

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

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

/* ============================================
   BADGES
   ============================================ */
.badge-modern {
    font-family: var(--font-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

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

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--color-info);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-primary {
    background: rgba(0, 212, 255, 0.2);
    color: var(--color-primary);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

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

.badge-secondary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--color-secondary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ============================================
   PULSE ANIMATION (for status indicators)
   ============================================ */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active {
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.status-dot.inactive {
    background: var(--color-text-muted);
}

.status-dot.running {
    background: var(--color-warning);
    animation: pulse 1.5s infinite;
}

/* ============================================
   TABLES
   ============================================ */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

.modern-table thead {
    background: var(--color-bg-tertiary);
}

.modern-table th {
    padding: var(--space-2);
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.modern-table td {
    padding: var(--space-2);
    border-bottom: 1px solid var(--color-divider);
    color: var(--color-text-primary);
}

.modern-table tbody tr {
    transition: background var(--transition-fast);
}

.modern-table tbody tr:hover {
    background: var(--color-bg-hover);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-3);
}

.form-label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-2);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

/* ============================================
   LOADING SKELETON
   ============================================ */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 0%,
        var(--color-bg-hover) 50%,
        var(--color-bg-tertiary) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--space-1);
}

.skeleton-title {
    height: 2rem;
    margin-bottom: var(--space-2);
    width: 60%;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-tooltip);
}

.toast {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    box-shadow: var(--shadow-xl);
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .modern-sidebar {
        transform: translateX(-100%);
    }

    .modern-sidebar.active {
        transform: translateX(0);
    }

    .modern-topbar {
        left: 0;
    }

    .modern-main {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    .modern-main {
        padding: var(--space-2);
    }

    .metric-value {
        font-size: 1.5rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

.bg-primary { background: var(--color-primary); }
.bg-card { background: var(--color-bg-card); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}
