@import 'tailwindcss';

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';

/* ============================================
   🎨 DESIGN SYSTEM - COLOR TOKENS
   ============================================ */

@theme {
    --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
        'Segoe UI Symbol', 'Noto Color Emoji';

    /* ========== BRAND COLORS ========== */
    --color-primary-50: #E8FAF0;
    --color-primary-100: #C7F4DB;
    --color-primary-200: #95EAB8;
    --color-primary-300: #5FDB94;
    --color-primary-400: #2ECF75;
    --color-primary-500: #16CC62;  /* Primary */
    --color-primary-600: #13B855;
    --color-primary-700: #0F9A45;
    --color-primary-800: #0C7D37;
    --color-primary-900: #09642C;

    --color-secondary-50: #EEEEFF;
    --color-secondary-100: #DDDCFF;
    --color-secondary-200: #C2C1FF;
    --color-secondary-300: #9E9DFF;
    --color-secondary-400: #7679FF;
    --color-secondary-500: #5D5FEF;  /* Secondary */
    --color-secondary-600: #4B4DD4;
    --color-secondary-700: #3C3EB5;
    --color-secondary-800: #303292;
    --color-secondary-900: #262876;

    /* ========== SEMANTIC COLORS ========== */
    --color-success-50: #E8FAF0;
    --color-success-500: #16CC62;
    --color-success-600: #13B855;

    --color-warning-50: #FEF3C7;
    --color-warning-500: #F59E0B;
    --color-warning-600: #D97706;

    --color-danger-50: #FEE2E2;
    --color-danger-500: #EF4444;
    --color-danger-600: #DC2626;

    --color-info-50: #EFF6FF;
    --color-info-500: #3B82F6;
    --color-info-600: #2563EB;

    /* ========== NEUTRAL COLORS (LIGHT MODE) ========== */
    --color-white: #FFFFFF;
    --color-black: #000000;

    --color-gray-50: #F8FAFB;
    --color-gray-100: #F1F5F9;
    --color-gray-200: #E2E8F0;
    --color-gray-300: #CBD5E1;
    --color-gray-400: #94A3B8;
    --color-gray-500: #64748B;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1E293B;
    --color-gray-900: #0F172A;

    /* ========== COMPONENT TOKENS (LIGHT) ========== */
    --color-bg-primary: var(--color-white);
    --color-bg-secondary: var(--color-gray-50);
    --color-bg-tertiary: var(--color-gray-100);
    --color-bg-hover: var(--color-gray-50);
    --color-bg-active: var(--color-gray-100);

    --color-text-primary: var(--color-gray-900);
    --color-text-secondary: var(--color-gray-600);
    --color-text-tertiary: var(--color-gray-400);
    --color-text-disabled: var(--color-gray-300);

    --color-border-primary: var(--color-gray-200);
    --color-border-secondary: var(--color-gray-300);
    --color-border-hover: var(--color-gray-300);
    --color-border-focus: var(--color-primary-500);

    /* ========== SHADOWS ========== */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* ========== RADIUSES ========== */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* ========== TRANSITIONS ========== */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* ========== COMPATIBILITY VARIABLES (من النظام القديم) ========== */
    --color-primary: var(--color-primary-500);
    --color-primary-hover: var(--color-primary-600);
    --color-primary-light: var(--color-primary-50);
    
    --color-secondary: var(--color-secondary-500);
    --color-secondary-hover: var(--color-secondary-600);
    --color-secondary-light: var(--color-secondary-50);
    
    --color-success: var(--color-success-500);
    --color-warning: var(--color-warning-500);
    --color-danger: var(--color-danger-500);
}

/* ============================================
   🌙 DARK MODE OVERRIDES
   ============================================ */

.dark {
    /* Brand Colors Stay Same */
    --color-primary-500: #16CC62;
    --color-secondary-500: #7679FF;

    /* Neutral Colors (Dark) - أفتح من الأول */
    --color-bg-primary: #1E293B;        /* كان gray-900 */
    --color-bg-secondary: #334155;      /* كان gray-800 */
    --color-bg-tertiary: #475569;       /* كان gray-700 */
    --color-bg-hover: #334155;          /* كان gray-800 */
    --color-bg-active: #475569;         /* كان gray-700 */

    --color-text-primary: #F8FAFC;      /* أبيض أكتر */
    --color-text-secondary: #CBD5E1;    /* كان gray-300 */
    --color-text-tertiary: #94A3B8;     /* كان gray-500 */
    --color-text-disabled: #64748B;     /* كان gray-600 */

    --color-border-primary: #475569;    /* كان gray-700 */
    --color-border-secondary: #64748B;  /* كان gray-600 */
    --color-border-hover: #64748B;      /* كان gray-600 */
    --color-border-focus: var(--color-primary-500);

    /* Adjusted Shadows for Dark Mode - أخف شوية */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);

    /* ========== COMPATIBILITY VARIABLES FOR DARK MODE ========== */
    --color-primary: #16CC62;
    --color-primary-hover: #13B855;
    --color-primary-light: rgba(22, 204, 98, 0.15);  /* أفتح شوية */
    
    --color-secondary: #7679FF;
    --color-secondary-hover: #5D5FEF;
    --color-secondary-light: rgba(93, 95, 239, 0.15); /* أفتح شوية */
}

.dark .text-lg {
    color: var(--color-text-primary) !important;
}

.dark .border-2 {
    border-color: var(--color-border-primary) !important;
}

.dark .border {
    border-color: var(--color-border-primary) !important;
}
.dark .border-b {
    border-color: var(--color-border-primary) !important;
}

.dark input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) hue-rotate(180deg);
}



.dark .border-b-2 {
    border-color: var(--color-border-primary) !important;
}

.dark .border-t {
    border-color: var(--color-border-primary) !important;
}

/* ============================================
   🎯 BASE COMPONENTS
   ============================================ */

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

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

::-webkit-scrollbar-thumb {
    background: var(--color-border-primary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-500);
}

/* Smooth Transitions */
/* Smooth Transitions - للعناصر المحددة بس */
.card,
.btn,
.input,
.badge,
.menu-item,
.action-button,
[class*="hover:"] {
    transition-property: background-color, border-color, color, fill, stroke, transform, box-shadow;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: var(--transition-base);
}

/* منع الـ transition للعناصر الغير محتاجة */
html,
body,
table,
thead,
tbody,
tr,
td,
th {
    transition: none !important;
}

/* ========== CURSOR UTILITIES ========== */
.cursor-pointer {
    cursor: pointer !important;
}

.cursor-move {
    cursor: move !important;
}

.cursor-grab {
    cursor: grab !important;
}

.cursor-grabbing {
    cursor: grabbing !important;
}

.cursor-not-allowed {
    cursor: not-allowed !important;
}

.cursor-default {
    cursor: default !important;
}

/* Force cursor for all interactive elements */
button:not(:disabled),
a:not(.disabled),
[role="button"],
select,
input[type="checkbox"],
input[type="radio"],
input[type="submit"],
input[type="button"],
.clickable {
    cursor: pointer !important;
}

/* Disabled elements */
button:disabled,
a.disabled,
input:disabled,
select:disabled,
textarea:disabled,
[disabled] {
    cursor: not-allowed !important;
    opacity: 0.6;
}


/* RTL Support */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .rotate-180 {
    transform: rotate(0deg);
}

[dir="ltr"] .rotate-180 {
    transform: rotate(180deg);
}

/* ============================================
   🧩 COMPONENT STYLES
   ============================================ */

/* Card Component */
.card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

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

/* ============================================
   🎨 BUTTON SYSTEM
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Button */
.btn-primary {
    background: var(--color-primary-500);
    color: var(--color-white);
    box-shadow: 0 1px 2px 0 rgba(22, 204, 98, 0.1);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 204, 98, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px 0 rgba(22, 204, 98, 0.2);
}

/* Secondary Button */
.btn-secondary {
    background: var(--color-secondary-500);
    color: var(--color-white);
    box-shadow: 0 1px 2px 0 rgba(93, 95, 239, 0.1);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-secondary-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(93, 95, 239, 0.3);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: var(--color-text-primary);
    border-color: var(--color-border-primary);
}


.btn-outline:hover:not(:disabled) {
    background: var(--color-bg-secondary);
    border-color: var(--color-primary-500);
    color: var(--color-primary-500);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

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

/* Danger Button */
.btn-danger {
    background: var(--color-danger-500);
    color: var(--color-white);
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-danger-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-xl);
}

.btn-icon {
    padding: 0.625rem;
    aspect-ratio: 1;
}

/* ============================================
   📝 INPUT SYSTEM
   ============================================ */

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

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

.input:hover:not(:disabled):not(:focus) {
    border-color: var(--color-border-hover);
}

.input:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px var(--color-primary-50);
}

.dark .input:focus {
    box-shadow: 0 0 0 3px rgba(22, 204, 98, 0.1);
}

.input:disabled {
    background: var(--color-bg-secondary);
    color: var(--color-text-disabled);
    cursor: not-allowed;
}

.input.error {
    border-color: var(--color-danger-500);
}

.input.error:focus {
    box-shadow: 0 0 0 3px var(--color-danger-50);
}

/* Input Sizes */
.input-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-md);
}

.input-lg {
    padding: 0.875rem 1.125rem;
    font-size: 1rem;
    border-radius: var(--radius-xl);
}

/* ============================================
   🔘 CHECKBOX & RADIO
   ============================================ */

.checkbox,
.radio {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--color-border-secondary);
    background: var(--color-bg-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.checkbox {
    border-radius: var(--radius-sm);
}

.radio {
    border-radius: var(--radius-full);
}

.checkbox:checked,
.radio:checked {
    background: var(--color-primary-500);
    border-color: var(--color-primary-500);
}

.checkbox:focus,
.radio:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-50);
}

/* ============================================
   🎭 BADGE SYSTEM
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
    border-radius: var(--radius-md);
    white-space: nowrap;
}

.badge-primary {
    background: var(--color-primary-50);
    color: var(--color-primary-600);
}

.badge-secondary {
    background: var(--color-secondary-50);
    color: var(--color-secondary-600);
}

.badge-success {
    background: var(--color-success-50);
    color: var(--color-success-600);
}

.badge-warning {
    background: var(--color-warning-50);
    color: var(--color-warning-600);
}

.badge-danger {
    background: var(--color-danger-50);
    color: var(--color-danger-600);
}

.badge-info {
    background: var(--color-info-50);
    color: var(--color-info-600);
}

/* ============================================
   📊 MENU ITEMS (من النظام القديم - محدث)
   ============================================ */

.menu-item {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    text-decoration: none;
}

.active-menu-item {
    background: linear-gradient(135deg, var(--color-primary) 0%, #13B855 100%);
    color: white !important;
    box-shadow: 0 4px 12px rgba(22, 204, 98, 0.3);
}

.submenu-item {
    color: var(--color-text-tertiary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.submenu-item:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    text-decoration: none;
}

.active-submenu-item {
    background: var(--color-primary-light);
    color: var(--color-primary) !important;
    font-weight: 600;
}

/* إزالة الخطوط السودا من كل الروابط والعناصر */
a {
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

button {
    text-decoration: none;
}

/* ============================================
   🎨 UTILITY CLASSES
   ============================================ */

.gradient-primary {
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-600) 100%);
}

.gradient-secondary {
    background: linear-gradient(135deg, var(--color-secondary-500) 0%, var(--color-secondary-600) 100%);
}

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

.text-secondary {
    color: var(--color-text-secondary);
}

.text-tertiary {
    color: var(--color-text-tertiary);
}

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

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

.hover\:bg-primary-light:hover {
    background: var(--color-primary-light);
}


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

.border-primary {
    border-color: var(--color-border-primary);
}

/* Logo Animation (من النظام القديم) */
.logo-bounce {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* ============================================
   🔘 TOGGLE SWITCH COMPONENT (Flowbite Style)
   ============================================ */

.toggle-wrapper {
    /* Base wrapper styles */
}

.toggle-label {
    /* Label container styles */
}

.toggle-track {
    /* Track (background) styles */
}

/* Fix text visibility and hover states */
.toggle-text {
    color: var(--color-text-primary) !important;
    transition: color 0.2s ease;
}

.toggle-text:hover {
    color: var(--color-primary-500) !important;
}

.toggle-description {
    color: var(--color-text-tertiary) !important;
    transition: color 0.2s ease;
}

.toggle-description:hover {
    color: var(--color-text-secondary) !important;
}

/* Disabled states */
.toggle-wrapper .cursor-not-allowed .toggle-text {
    color: var(--color-text-disabled) !important;
}

.toggle-wrapper .cursor-not-allowed .toggle-description {
    color: var(--color-text-disabled) !important;
}

/* Dark mode fixes */
.dark .toggle-text {
    color: var(--color-text-primary) !important;
}

.dark .toggle-description {
    color: var(--color-text-tertiary) !important;
}

/* Focus and hover improvements */
.toggle-label:hover .toggle-track {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dark .toggle-label:hover .toggle-track {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Active state */
.toggle-label:active .toggle-track::after {
    transform: scale(0.95);
}

/* RTL support improvements */
[dir="rtl"] .toggle-track::after {
    right: 2px;
    left: auto;
}

/* Variant colors using CSS variables */
.toggle-track.peer-checked\:bg-blue-600:has(.peer:checked) {
    background-color: var(--color-primary-500) !important;
}

.toggle-track.peer-checked\:bg-green-600:has(.peer:checked) {
    background-color: var(--color-success-500) !important;
}

.toggle-track.peer-checked\:bg-red-600:has(.peer:checked) {
    background-color: var(--color-danger-500) !important;
}

.toggle-track.peer-checked\:bg-yellow-600:has(.peer:checked) {
    background-color: var(--color-warning-500) !important;
}

.toggle-track.peer-checked\:bg-gray-600:has(.peer:checked) {
    background-color: var(--color-secondary-500) !important;
}

/* Alternative approach without :has() */
.peer:checked + .toggle-track.peer-checked\:bg-blue-600 {
    background-color: var(--color-primary-500) !important;
}

.peer:checked + .toggle-track.peer-checked\:bg-green-600 {
    background-color: var(--color-success-500) !important;
}

.peer:checked + .toggle-track.peer-checked\:bg-red-600 {
    background-color: var(--color-danger-500) !important;
}

.peer:checked + .toggle-track.peer-checked\:bg-yellow-600 {
    background-color: var(--color-warning-500) !important;
}

.peer:checked + .toggle-track.peer-checked\:bg-gray-600 {
    background-color: var(--color-secondary-500) !important;
}

/* ============================================
   🔒 ALPINE.JS - X-CLOAK
   Hide elements until Alpine.js is loaded
   ============================================ */
[x-cloak] {
    display: none !important;
}