/* PROP AXIS - Enterprise Design System Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-ar: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    
    /* Default Light Mode Palette */
    --body-bg: #f8fafc;
    --body-text: #0f172a;
    
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --sidebar-text: #475569;
    --sidebar-hover: #f1f5f9;
    --sidebar-active-bg: #2563eb;
    --sidebar-active-text: #ffffff;
    
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --table-header-bg: #f8fafc;
    --table-row-hover: #f1f5f9;
    
    --badge-critical-bg: #ffe4e6;
    --badge-critical-text: #be123c;
    --badge-high-bg: #ffedd5;
    --badge-high-text: #c2410c;
    --badge-medium-bg: #fef3c7;
    --badge-medium-text: #b45309;
    --badge-low-bg: #e0f2fe;
    --badge-low-text: #0369a1;
}

/* Dark Mode Overrides */
html.dark {
    --body-bg: #020617;
    --body-text: #f8fafc;
    
    --sidebar-bg: #0b1329;
    --sidebar-border: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active-bg: #2563eb;
    --sidebar-active-text: #ffffff;
    
    --card-bg: #0f172a;
    --card-border: #1e293b;
    --table-header-bg: #1e293b;
    --table-row-hover: #1e293b/60;
}

/* Global Dark Mode Element Styles */
html.dark .bg-white {
    background-color: #0f172a !important;
    color: #f1f5f9;
}
html.dark .bg-slate-50 {
    background-color: #070d1e !important;
}
html.dark .bg-slate-100 {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}
html.dark .border-slate-200 {
    border-color: #1e293b !important;
}
html.dark .border-slate-100 {
    border-color: #1e293b !important;
}
html.dark .text-slate-900 {
    color: #f8fafc !important;
}
html.dark .text-slate-800 {
    color: #f1f5f9 !important;
}
html.dark .text-slate-700 {
    color: #e2e8f0 !important;
}
html.dark .text-slate-600 {
    color: #cbd5e1 !important;
}
html.dark .text-slate-500 {
    color: #94a3b8 !important;
}
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-slate-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: #1e293b !important;
}
html.dark input:not([type="checkbox"]):not([type="radio"]), 
html.dark select, 
html.dark textarea {
    background-color: #0b1329 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #64748b !important;
}
html.dark .shadow-sm,
html.dark .shadow,
html.dark .shadow-md,
html.dark .shadow-xl,
html.dark .shadow-2xl {
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5) !important;
}

body {
    font-family: var(--font-sans);
    background-color: var(--body-bg);
    color: var(--body-text);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* RTL Support for Arabic */
[dir="rtl"] body,
[dir="rtl"] {
    font-family: var(--font-ar);
    text-align: right;
}

[dir="rtl"] .font-code {
    direction: ltr;
    display: inline-block;
}

[dir="rtl"] .enterprise-table th,
[dir="rtl"] .enterprise-table td {
    text-align: right;
}

[dir="rtl"] .status-dot {
    margin-right: 0;
    margin-left: 0.375rem;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
html.dark ::-webkit-scrollbar-track {
    background: #0f172a;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
html.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Monospace Codes */
.font-code {
    font-family: var(--font-mono);
    font-size: 0.825rem;
    letter-spacing: -0.02em;
}

/* Data Tables */
.enterprise-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.enterprise-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}
html.dark .enterprise-table th {
    background-color: #0f172a;
    color: #94a3b8;
    border-bottom: 1px solid #1e293b;
}
.enterprise-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    color: #1e293b;
    vertical-align: middle;
}
html.dark .enterprise-table td {
    border-bottom: 1px solid #1e293b;
    color: #e2e8f0;
}
.enterprise-table tbody tr {
    transition: background-color 0.15s ease;
}
.enterprise-table tbody tr:hover {
    background-color: #f8fafc;
}
html.dark .enterprise-table tbody tr:hover {
    background-color: #1e293b/60;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.375rem;
}

.status-open { background-color: #e0f2fe; color: #0369a1; }
.status-open .status-dot { background-color: #0284c7; }
html.dark .status-open { background-color: #0369a1/20; color: #7dd3fc; }

.status-assigned { background-color: #ede9fe; color: #6d28d9; }
.status-assigned .status-dot { background-color: #7c3aed; }
html.dark .status-assigned { background-color: #6d28d9/20; color: #c4b5fd; }

.status-inprogress { background-color: #fef3c7; color: #b45309; }
.status-inprogress .status-dot { background-color: #f59e0b; animation: pulseDot 1.5s infinite; }
html.dark .status-inprogress { background-color: #b45309/20; color: #fcd34d; }

.status-onhold, .status-pendingparts { background-color: #ffedd5; color: #c2410c; }
.status-onhold .status-dot, .status-pendingparts .status-dot { background-color: #f97316; }
html.dark .status-onhold, html.dark .status-pendingparts { background-color: #c2410c/20; color: #fdba74; }

.status-completed { background-color: #d1fae5; color: #065f46; }
.status-completed .status-dot { background-color: #10b981; }
html.dark .status-completed { background-color: #065f46/20; color: #6ee7b7; }

.status-closed { background-color: #f1f5f9; color: #475569; }
.status-closed .status-dot { background-color: #64748b; }
html.dark .status-closed { background-color: #334155/30; color: #94a3b8; }

.status-cancelled { background-color: #fee2e2; color: #991b1b; }
.status-cancelled .status-dot { background-color: #ef4444; }
html.dark .status-cancelled { background-color: #991b1b/20; color: #fca5a5; }

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Priority Badges */
.priority-critical { background-color: #ffe4e6; color: #be123c; border: 1px solid #fecdd3; }
.priority-high { background-color: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.priority-medium { background-color: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.priority-low { background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

html.dark .priority-critical { background-color: #9f1239/20; color: #fda4af; border: 1px solid #9f1239/40; }
html.dark .priority-high { background-color: #9a3412/20; color: #fdba74; border: 1px solid #9a3412/40; }
html.dark .priority-medium { background-color: #854d0e/20; color: #fde047; border: 1px solid #854d0e/40; }
html.dark .priority-low { background-color: #075985/20; color: #7dd3fc; border: 1px solid #075985/40; }

/* Status Timeline */
.wo-timeline {
    display: flex;
    align-items: center;
    position: relative;
}
.timeline-step {
    flex: 1;
    text-align: center;
    position: relative;
}
.timeline-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 3px;
    background-color: #e2e8f0;
    z-index: 1;
}
html.dark .timeline-step:not(:last-child)::after {
    background-color: #334155;
}
[dir="rtl"] .timeline-step:not(:last-child)::after {
    left: auto;
    right: 50%;
}
.timeline-step.completed:not(:last-child)::after {
    background-color: #10b981;
}
.timeline-step.active:not(:last-child)::after {
    background: linear-gradient(90deg, #3b82f6 0%, #e2e8f0 100%);
}
.timeline-node {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 3px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: all 0.2s ease;
}
html.dark .timeline-node {
    background-color: #0f172a;
    border-color: #475569;
}
.timeline-step.completed .timeline-node {
    background-color: #10b981;
    border-color: #10b981;
    color: #ffffff;
}
.timeline-step.active .timeline-node {
    background-color: #3b82f6;
    border-color: #93c5fd;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Field Technician Big Buttons */
.touch-action-btn {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}
.touch-action-btn:active {
    transform: scale(0.98);
}
