/* UMBRELLA INDUSTRIAL SERVICES - Enhanced UI Components */

/* ===== VARIABLES CSS ===== */
:root {
    /* Couleurs principales */
    --vscode-blue: #007acc;
    --light-blue: #3b82f6;
    --night-blue: #1e293b;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    
    /* Couleurs d'état */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Rayons de bordure */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--slate-700);
    background-color: var(--slate-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== SCROLLBAR PERSONNALISÉE ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--slate-100);
    border-radius: var(--radius);
}

::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: var(--radius);
    transition: background var(--transition-normal);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}

/* ===== COMPOSANTS DE CARTE ===== */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: all var(--transition-slow);
    border: 1px solid var(--slate-200);
}

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

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--slate-200);
    background: linear-gradient(135deg, var(--slate-50) 0%, white 100%);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--slate-200);
    background: var(--slate-50);
}

/* ===== COMPOSANTS DE BOUTON ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--vscode-blue) 0%, var(--light-blue) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 122, 204, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 204, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--slate-600) 0%, var(--slate-700) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(71, 85, 105, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(71, 85, 105, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--vscode-blue);
    color: var(--vscode-blue);
}

.btn-outline:hover {
    background: var(--vscode-blue);
    color: white;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.75rem;
    border-radius: var(--radius-full);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== COMPOSANTS DE FORMULAIRE ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border: 2px solid var(--slate-200);
    border-radius: var(--radius-lg);
    background: white;
    transition: all var(--transition-normal);
    outline: none;
}

.form-input:focus {
    border-color: var(--vscode-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.1);
    transform: translateY(-1px);
}

.form-input:hover {
    border-color: var(--slate-300);
}

.form-input.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.success {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--slate-300);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.form-checkbox:checked {
    background: var(--vscode-blue);
    border-color: var(--vscode-blue);
}

.form-error {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-help {
    color: var(--slate-500);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ===== COMPOSANTS DE NAVIGATION ===== */
.navbar {
    background: linear-gradient(135deg, var(--night-blue) 0%, var(--slate-800) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg);
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: var(--slate-300);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    position: relative;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    color: white;
    background: rgba(0, 122, 204, 0.2);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background: var(--vscode-blue);
    border-radius: var(--radius-full);
}

/* ===== COMPOSANTS DE BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background: rgba(0, 122, 204, 0.1);
    color: var(--vscode-blue);
    border: 1px solid rgba(0, 122, 204, 0.2);
}

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

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

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

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

.badge-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--slate-600);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* ===== COMPOSANTS DE STATISTIQUES ===== */
.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--slate-200);
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--vscode-blue), var(--light-blue));
}

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

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--vscode-blue), var(--light-blue));
    color: white;
    box-shadow: 0 8px 16px rgba(0, 122, 204, 0.3);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--slate-900);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--slate-600);
    font-weight: 500;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

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

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

/* ===== COMPOSANTS DE TABLEAU ===== */
.table-container {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--slate-200);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background: linear-gradient(135deg, var(--night-blue) 0%, var(--slate-700) 100%);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table th:first-child {
    border-top-left-radius: var(--radius-xl);
}

.table th:last-child {
    border-top-right-radius: var(--radius-xl);
}

.table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--slate-200);
    font-size: 0.875rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: all var(--transition-normal);
}

.table tbody tr:hover {
    background: var(--slate-50);
    transform: scale(1.01);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== COMPOSANTS DE MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-slow);
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: between;
    background: linear-gradient(135deg, var(--slate-50) 0%, white 100%);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slate-900);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--slate-400);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
}

.modal-close:hover {
    color: var(--slate-600);
    background: var(--slate-100);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--slate-200);
    background: var(--slate-50);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ===== COMPOSANTS DE NOTIFICATION ===== */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    min-width: 300px;
    max-width: 400px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-xl);
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-2xl);
    transform: translateX(100%);
    transition: all var(--transition-slow);
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.toast.error {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
}

.toast.info {
    background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
}

.toast.warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius);
    opacity: 0.8;
    transition: opacity var(--transition-normal);
}

.toast-close:hover {
    opacity: 1;
}

/* ===== COMPOSANTS DE CHARGEMENT ===== */
.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--slate-200);
    border-top: 2px solid var(--vscode-blue);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.loading-dots span {
    width: 0.5rem;
    height: 0.5rem;
    background: var(--vscode-blue);
    border-radius: var(--radius-full);
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ===== COMPOSANTS DE PROGRESSION ===== */
.progress {
    width: 100%;
    height: 0.5rem;
    background: var(--slate-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--vscode-blue), var(--light-blue));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

/* ===== UTILITAIRES RESPONSIVE ===== */
@media (max-width: 640px) {
    .mobile-hidden { display: none !important; }
    .mobile-full { width: 100% !important; }
    .mobile-stack { flex-direction: column !important; }
    .mobile-text-sm { font-size: 0.875rem !important; }
    .mobile-p-2 { padding: 0.5rem !important; }
    .mobile-gap-2 { gap: 0.5rem !important; }
    
    .card-body { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .modal { margin: 1rem; max-width: calc(100vw - 2rem); }
    .toast { right: 1rem; left: 1rem; min-width: auto; }
}

@media (max-width: 768px) {
    .tablet-hidden { display: none !important; }
    .tablet-grid-1 { grid-template-columns: 1fr !important; }
    .tablet-text-sm { font-size: 0.875rem !important; }
    
    .navbar-nav { flex-direction: column; gap: 0.5rem; }
    .table-container { overflow-x: auto; }
}

/* ===== ANIMATIONS D'ENTRÉE ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

.animate-fade-in { animation: fadeIn 0.5s ease-out; }
.animate-slide-up { animation: slideInUp 0.5s ease-out; }
.animate-slide-right { animation: slideInRight 0.5s ease-out; }
.animate-scale-in { animation: scaleIn 0.5s ease-out; }

/* ===== STYLES D'IMPRESSION ===== */
@media print {
    .no-print { display: none !important; }
    .print-break { page-break-before: always; }
    
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .card, .stat-card, .table-container {
        box-shadow: none;
        border: 1px solid var(--slate-300);
    }
}

/* ===== FOCUS VISIBLE ===== */
.btn:focus-visible,
.form-input:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid var(--vscode-blue);
    outline-offset: 2px;
}

/* ===== ÉTATS DÉSACTIVÉS ===== */
.btn:disabled,
.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== SÉLECTION DE TEXTE ===== */
::selection {
    background: rgba(0, 122, 204, 0.2);
    color: var(--slate-900);
}

/* ===== FOCUS TRAP ===== */
.focus-trap {
    position: relative;
}

.focus-trap::before,
.focus-trap::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}