/* ============================================
   LinaSoft ERP - Professional ERP Styles
   Inspired by: Sage 100, SAP, Odoo
   ============================================ */

/* === BRAND COLORS === */
:root {
    --linasoft-cyan: #06b6d4;
    --linasoft-green: #10b981;
    --linasoft-gradient: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
}

/* === ANIMATIONS (MINIMAL ET SOBRES) === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Classe d'animation fade-in */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
    animation: slideInRight 0.3s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.2s ease-out;
}

/* === BRAND === */
.logo-gradient {
    background: var(--linasoft-gradient);
}

.logo-text {
    background: var(--linasoft-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === NAVBAR === */
.navbar-glass {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* === SIDEBAR MODERNE & COLORÉE === */
.sidebar-bg {
    /* Fond dégradé subtil et moderne */
    background: linear-gradient(
        180deg,
        #f8fafc 0%,      /* Slate très clair */
        #f1f5f9 50%,     /* Slate clair */
        #e2e8f0 100%     /* Slate moyen */
    );
    border-right: 2px solid rgba(100, 116, 139, 0.15);
    box-shadow: 2px 0 12px rgba(100, 116, 139, 0.08);
}

.sidebar-logo {
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    margin: 0 -1rem;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    backdrop-filter: blur(10px);
}

.logo-gradient {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo-text {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b !important;
    padding: 0.5rem 1rem;
    margin-top: 0.75rem;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.sidebar-link {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem !important;
    margin: 0.25rem 0.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: #475569;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: all 0.25s ease;
}

/* Icônes colorées par section */
.sidebar-link svg {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    transition: all 0.25s ease;
}

/* Dashboard - Indigo */
.sidebar-link[href*="dashboard"] svg {
    color: #6366f1;
}

/* Section Ventes - Blue/Purple */
.sidebar-link[href*="customer"] svg {
    color: #3b82f6;
}
.sidebar-link[href*="invoice"] svg {
    color: #8b5cf6;
}
.sidebar-link[href*="payment"] svg {
    color: #ec4899;
}

/* Section Achats - Orange/Purple */
.sidebar-link[href*="supplier"] svg {
    color: #f59e0b;
}
.sidebar-link[href*="purchase"] svg {
    color: #8b5cf6;
}

/* Section Inventaire - Green/Cyan */
.sidebar-link[href*="item"] svg {
    color: #10b981;
}
.sidebar-link[href*="stock"] svg {
    color: #06b6d4;
}

/* Section Rapports - Purple/Pink */
.sidebar-link[href*="sales_report"] svg {
    color: #8b5cf6;
}
.sidebar-link[href*="payments_report"] svg {
    color: #ec4899;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.15);
}

.sidebar-link:hover::before {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    width: 3px;
}

.sidebar-link:hover svg {
    transform: scale(1.15);
}

.sidebar-link.active {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
    transform: translateX(4px);
}

.sidebar-link.active::before {
    background: rgba(255, 255, 255, 0.4);
    width: 4px;
}

.sidebar-link.active svg {
    color: white !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

/* === CARDS (SOBRE TYPE ERP) === */
.card-glass {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.card-glass:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* === BUTTONS === */
.btn {
    transition: all 0.15s ease;
}

.btn:hover {
    filter: brightness(1.05);
}

.btn:active {
    filter: brightness(0.95);
}

.btn-premium {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.btn-premium:hover {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.btn-premium:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Boutons secondaires */
.btn-ghost {
    background: white;
    color: #475569;
    border: 2px solid #e2e8f0;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

/* === BADGES (STATUTS DOCUMENTS) === */
.badge {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Badges spécifiques statuts */
.badge-draft {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    border: none;
}

.badge-validated {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    border: none;
}

.badge-paid {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
}

/* === TABLES (TYPE SAGE 100 - ENHANCED) === */
.table-premium {
    border-collapse: separate;
    border-spacing: 0;
}

.table-premium thead {
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    border-bottom: 3px solid #6b7280;
}

.table-premium thead th {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    padding: 1rem 1rem;
    text-align: left;
    border-bottom: 3px solid #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table-premium tbody tr {
    transition: all 0.2s ease;
    border-bottom: 2px solid #9ca3af;
    position: relative;
}

/* Zebra striping pour meilleure lisibilité */
.table-premium tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.table-premium tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* Hover subtil pour les lignes de tableau */
.table-premium tbody tr:hover {
    background-color: #f8fafc;
    transition: background-color 0.15s ease;
}

.table-premium tbody td {
    padding: 1rem 1rem;
}

/* Première colonne avec style accentué */
.table-premium tbody td:first-child {
    font-weight: 500;
    color: #0f766e;
}

/* === LINKS === */
.link-primary {
    color: #0891b2;
    text-decoration: none;
    transition: all 0.15s ease;
}

.link-primary:hover {
    color: #0e7490;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* === PAGE TITLES === */
.page-title {
    color: #1e293b; /* Slate foncé pour meilleure lisibilité */
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* === INPUTS (FOCUS PROFESSIONNEL) === */
.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--linasoft-cyan);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.1);
    outline: none;
}

.input:disabled,
.select:disabled,
.textarea:disabled {
    background-color: #f9fafb;
    cursor: not-allowed;
    opacity: 0.6;
}

/* États de validation */
.input.error,
.select.error,
.textarea.error {
    border-color: #ef4444;
}

.input.success,
.select.success,
.textarea.success {
    border-color: #10b981;
}

/* === LOADING INDICATOR (HTMX) === */
.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* === SCROLLBAR (SOBRE) === */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* === ALERTS & TOASTS === */
.alert {
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background-color: #d1fae5;
    border: 1px solid #10b981;
    color: #065f46;
}

.alert-error {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    border: 1px solid #3b82f6;
    color: #1e40af;
}

/* === STATS CARDS (SOBRE ERP) === */
.stats-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.stats-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.5rem;
}

.stats-card-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #111827;
    line-height: 1;
}

.stats-card-label {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* === KPI CARDS (MODERN DASHBOARD) === */
.kpi-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.kpi-card-gradient {
    background: var(--linasoft-gradient);
    border: none;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.kpi-card-gradient:hover {
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
}

.kpi-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: #111827;
}

.kpi-icon-wrapper {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* === KPI CARDS PRO (DESIGN SAGE/ODOO) === */
.kpi-card-pro {
    background: white;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.kpi-card-pro::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.kpi-card-pro:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.kpi-card-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kpi-icon-circle {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.kpi-icon-circle svg {
    width: 1.375rem;
    height: 1.375rem;
}

.kpi-text {
    flex: 1;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 0.375rem;
}

.kpi-number {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

/* Variants Primary (Gradient cyan-green) */
.kpi-card-primary {
    border-left-color: #06b6d4;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
}

.kpi-card-primary::before {
    background: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
}

.kpi-icon-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.kpi-number-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Variants Success (Green) */
.kpi-card-success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.kpi-card-success::before {
    background: #10b981;
}

.kpi-icon-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.kpi-number-success {
    color: #059669;
}

/* Variants Info (Cyan) */
.kpi-card-info {
    border-left-color: #06b6d4;
    background: linear-gradient(135deg, #ffffff 0%, #ecfeff 100%);
}

.kpi-card-info::before {
    background: #06b6d4;
}

.kpi-icon-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.kpi-number-info {
    color: #0891b2;
}

/* Variants Blue (Bleu moderne) */
.kpi-card-blue {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}

.kpi-card-blue::before {
    background: #3b82f6;
}

.kpi-icon-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.kpi-number-blue {
    color: #2563eb;
}

/* Variants Purple (Violet moderne) */
.kpi-card-purple {
    border-left-color: #8b5cf6;
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
}

.kpi-card-purple::before {
    background: #8b5cf6;
}

.kpi-icon-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.kpi-number-purple {
    color: #7c3aed;
}

/* Variants Orange (Orange moderne) */
.kpi-card-orange {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

.kpi-card-orange::before {
    background: #f59e0b;
}

.kpi-icon-orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.kpi-number-orange {
    color: #d97706;
}

/* Variants Pink (Rose moderne) */
.kpi-card-pink {
    border-left-color: #ec4899;
    background: linear-gradient(135deg, #ffffff 0%, #fdf2f8 100%);
}

.kpi-card-pink::before {
    background: #ec4899;
}

.kpi-icon-pink {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.kpi-number-pink {
    color: #db2777;
}

/* Responsive */
@media (max-width: 768px) {
    .kpi-card-pro {
        padding: 1rem;
    }

    .kpi-icon-circle {
        width: 2.5rem;
        height: 2.5rem;
    }

    .kpi-icon-circle svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    .kpi-number {
        font-size: 1.5rem;
    }

    .kpi-label {
        font-size: 0.688rem;
    }
}

/* === TOOLTIPS === */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background-color: #1f2937;
    color: white;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    z-index: 1000;
}

/* === MODAL (HTMX) === */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-box {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* === FORM SECTIONS === */
.form-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

/* === WORKFLOW BUTTONS === */
.workflow-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
}

.workflow-btn-validate {
    background-color: #10b981;
    color: white;
}

.workflow-btn-validate:hover {
    background-color: #059669;
}

.workflow-btn-draft {
    background-color: #f59e0b;
    color: white;
}

.workflow-btn-draft:hover {
    background-color: #d97706;
}

/* === DENSITÉ ERP === */
.dense-row {
    padding: 0.5rem 0.75rem;
}

.compact-spacing {
    gap: 0.75rem;
}

/* === RESPONSIVE PROFESSIONNEL === */
@media (max-width: 768px) {
    .table-premium {
        font-size: 0.875rem;
    }

    .table-premium thead th,
    .table-premium tbody td {
        padding: 0.5rem 0.75rem;
    }

    .stats-card-value {
        font-size: 1.875rem;
    }
}

/* === FLOATING ACTION BUTTON (FAB) === */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--linasoft-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 50;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

/* === PRINT STYLES === */
@media print {
    .no-print, .fab {
        display: none !important;
    }

    .card-glass {
        box-shadow: none;
        border: 1px solid #000;
    }

    .page-title {
        color: #000;
        -webkit-text-fill-color: #000;
    }
}
