/* ==================================
   DCS Logistique - Custom Styles
   ================================== */

:root {
    --dcs-primary: #E63946;
    --dcs-secondary: #F77F00;
    --dcs-accent: #FCBF49;
    --dcs-dark: #264653;
    --dcs-green: #2A9D8F;
    --dcs-blue: #457B9D;
    --dcs-cream: #F1FAEE;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
}

body[dir="rtl"] {
    font-family: 'Tajawal', sans-serif;
}

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c4c4c4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* ==================================
   Navigation
   ================================== */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.25s ease;
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateX(3px);
}

body[dir="rtl"] .nav-link:hover {
    transform: translateX(-3px);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--dcs-primary), var(--dcs-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.nav-link.active:hover { transform: none; }

/* ==================================
   Cards & Components
   ================================== */
.dcs-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    transition: all 0.25s ease;
    border: 1px solid rgba(0,0,0,0.04);
}

.dcs-card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    transform: translateY(-2px);
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    border-radius: 1rem;
    color: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover { transform: translateY(-4px) scale(1.02); }

.stat-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.12);
    border-radius: 50%;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

/* ==================================
   Buttons
   ================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--dcs-primary), var(--dcs-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.25);
}
.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(230, 57, 70, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--dcs-dark);
    border: 1px solid #e5e7eb;
}
.btn-secondary:hover { background: #f9fafb; border-color: #d1d5db; }

.btn-danger {
    background: #ef4444;
    color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-success {
    background: var(--dcs-green);
    color: white;
}
.btn-success:hover { background: #21867b; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; width: 2.25rem; height: 2.25rem; }

/* ==================================
   Form Elements
   ================================== */
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.4rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.625rem;
    font-size: 0.9rem;
    background: white;
    transition: all 0.2s;
    font-family: inherit;
}

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

.form-textarea { resize: vertical; min-height: 80px; }

/* ==================================
   Badges
   ================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-teal { background: #ccfbf1; color: #115e59; }

/* ==================================
   Progress Bar
   ================================== */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, var(--dcs-primary), var(--dcs-secondary));
    transition: width 0.5s ease;
}

.progress-fill.green { background: linear-gradient(90deg, var(--dcs-green), #4ade80); }
.progress-fill.blue { background: linear-gradient(90deg, var(--dcs-blue), #60a5fa); }

/* ==================================
   Tables
   ================================== */
.dcs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.dcs-table thead th {
    background: #f9fafb;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #4b5563;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}

body[dir="rtl"] .dcs-table thead th { text-align: right; }

.dcs-table tbody td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.dcs-table tbody tr { transition: background 0.15s; }
.dcs-table tbody tr:hover { background: #fafafa; }

/* ==================================
   Animations
   ================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.animate-fade-in { animation: fadeIn 0.4s ease; }
.animate-slide-in { animation: slideIn 0.3s ease; }

/* ==================================
   Toast
   ================================== */
.toast {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    color: white;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast-success { background: linear-gradient(135deg, var(--dcs-green), #059669); }
.toast-error { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast-info { background: linear-gradient(135deg, var(--dcs-blue), #2563eb); }
.toast-warning { background: linear-gradient(135deg, var(--dcs-secondary), #ea580c); }

/* ==================================
   Modal
   ================================== */
#modal-container.active {
    display: flex !important;
    animation: fadeIn 0.25s ease;
}

#modal-content {
    animation: fadeIn 0.3s ease;
}

/* ==================================
   FullCalendar customisations
   ================================== */
.fc {
    font-family: inherit !important;
}

.fc-theme-standard td, .fc-theme-standard th {
    border-color: #f3f4f6;
}

.fc-toolbar-title {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: var(--dcs-dark);
}

.fc-button-primary {
    background-color: var(--dcs-primary) !important;
    border-color: var(--dcs-primary) !important;
    font-weight: 500 !important;
}

.fc-button-primary:hover,
.fc-button-primary:not(:disabled):active {
    background-color: var(--dcs-secondary) !important;
    border-color: var(--dcs-secondary) !important;
}

.fc-event {
    border: none !important;
    border-radius: 6px !important;
    padding: 2px 6px !important;
    font-size: 0.8rem !important;
    cursor: pointer;
}

.fc-daygrid-day.fc-day-today {
    background-color: rgba(252, 191, 73, 0.12) !important;
}

/* ==================================
   RTL Adjustments
   ================================== */
body[dir="rtl"] .rtl-flip { transform: scaleX(-1); }

body[dir="rtl"] #sidebar {
    box-shadow: -10px 0 25px rgba(0,0,0,0.1);
}

/* ==================================
   Responsive
   ================================== */
@media (max-width: 1024px) {
    #main-nav.open {
        display: block !important;
    }
    
    #sidebar {
        position: relative;
    }
}

/* ==================================
   Utilities
   ================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.space-icon-circle {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover { border-color: var(--dcs-primary); color: var(--dcs-primary); }
.filter-chip.active {
    background: var(--dcs-primary);
    color: white;
    border-color: var(--dcs-primary);
}

/* Print */
@media print {
    #sidebar, header, .no-print { display: none !important; }
    main { padding: 0 !important; }
}
