/* Reset et variables CSS */
:root {
    --red-accent: #dc2626;
    --sidebar-bg: #1e1b4b;
    --sidebar-hover: #312e81;
    --sidebar-active: #4338ca;
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --primary-blue: #3b82f6;
    --primary-blue-hover: #2563eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Barre rouge en haut */
.top-red-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--red-accent) 0%, #b91c1c 100%);
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

/* Container principal */
.app-container {
    display: flex;
    min-height: 100vh;
    padding-top: 4px;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #1e1b4b 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 4px;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-header {
    padding: 1.75rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar-nav {
    padding: 1.25rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    margin: 0.125rem 0.5rem;
    border-radius: var(--radius);
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: white;
    border-radius: 0 2px 2px 0;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
    transform: translateX(2px);
}

.nav-item:hover::before {
    height: 60%;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 2px 8px rgba(67, 56, 202, 0.3);
}

.nav-item.active::before {
    height: 70%;
}

.nav-item-header {
    display: flex;
    align-items: center;
    width: 100%;
}

.nav-icon {
    margin-right: 0.875rem;
    font-size: 1.15rem;
    width: 20px;
    text-align: center;
}

.nav-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-arrow {
    font-size: 0.7rem;
    opacity: 0.8;
    transition: var(--transition);
}

.nav-item.active .nav-arrow {
    opacity: 1;
}

/* Main Content Wrapper */
.main-content-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-secondary);
}

/* Main Header */
.main-header {
    background: var(--bg-primary);
    padding: 1.5rem 2.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 4px;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.page-title {
    font-size: 1.625rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.625rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: var(--transition);
    border-radius: var(--radius);
    width: 40px;
    height: 40px;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-color: var(--border-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2.5rem;
    background: var(--bg-secondary);
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Error Message */
.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid var(--error-color);
    border-left: 4px solid var(--error-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.75rem;
    color: var(--error-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    font-weight: 500;
}

.error-message span:first-child {
    font-size: 1.5rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 2rem;
}

.page-header-left {
    flex: 1;
}

.content-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.content-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-hover) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    white-space: nowrap;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-blue-hover) 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.2);
}

/* Filters Section */
.filters-section {
    margin-bottom: 2rem;
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.applied-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.filter-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.filter-tag:hover {
    border-color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.05);
}

.filter-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.filter-remove:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.clear-link {
    background: none;
    border: none;
    color: var(--primary-blue);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.clear-link:hover {
    background: rgba(59, 130, 246, 0.1);
    text-decoration: underline;
}

.search-filters-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box {
    flex: 1;
    position: relative;
    max-width: 500px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--bg-primary);
    transition: var(--transition);
    color: var(--text-primary);
}

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

.search-box input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-clear {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-filter {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text-primary);
    transition: var(--transition);
    font-weight: 500;
    white-space: nowrap;
}

.btn-filter:hover {
    border-color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.05);
    color: var(--primary-blue);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.filter-badge {
    background: var(--primary-blue);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Table Container */
.table-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.workflows-table {
    width: 100%;
    border-collapse: collapse;
}

.workflows-table thead {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.workflows-table th {
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.workflows-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.95rem;
    color: var(--text-primary);
    vertical-align: middle;
}

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

.workflows-table tbody tr:hover {
    background: var(--bg-secondary);
    transform: scale(1.001);
}

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

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.status-badge.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.1) 100%);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.inactive {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.15) 0%, rgba(107, 114, 128, 0.1) 100%);
    color: var(--text-secondary);
    border: 1px solid rgba(107, 114, 128, 0.2);
}

/* Tags */
.workflow-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.workflow-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.workflow-tag:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

/* Actions */
.action-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition);
    font-weight: 500;
    white-space: nowrap;
}

.action-btn:hover {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.action-btn:active {
    transform: translateY(0);
}

/* Empty State */
.empty-state {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 5rem 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    opacity: 0.4;
    filter: grayscale(0.3);
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Results Count */
.results-count {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.75rem 0;
}

.results-count span {
    font-weight: 700;
    color: var(--text-primary);
}

/* No JS Message */
.no-js-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: var(--error-color);
    padding: 1.5rem;
    text-align: center;
    margin: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--error-color);
    box-shadow: var(--shadow-md);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-area {
        padding: 1.5rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .main-content-wrapper {
        margin-left: 0;
    }
    
    .main-header {
        padding: 1.25rem 1.5rem;
    }
    
    .content-area {
        padding: 1.25rem;
    }
    
    .content-title {
        font-size: 1.5rem;
    }
    
    .search-filters-row {
        flex-direction: column;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .workflows-table {
        font-size: 0.875rem;
        display: block;
        overflow-x: auto;
    }
    
    .workflows-table thead,
    .workflows-table tbody,
    .workflows-table tr,
    .workflows-table td,
    .workflows-table th {
        display: block;
    }
    
    .workflows-table thead {
        display: none;
    }
    
    .workflows-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        padding: 1rem;
        background: var(--bg-primary);
        box-shadow: var(--shadow-sm);
    }
    
    .workflows-table td {
        border: none;
        padding: 0.5rem 0;
        text-align: left;
    }
    
    .workflows-table td::before {
        content: attr(data-label) ': ';
        font-weight: 700;
        color: var(--text-secondary);
        margin-right: 0.5rem;
    }
}

/* Écran d'authentification amélioré - Style dashboard */
.auth-screen {
    position: fixed;
    top: 4px;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #1e1b4b 50%, #312e81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    overflow: hidden;
}

.auth-screen::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(67, 56, 202, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.2) 0%, transparent 50%);
    pointer-events: none;
}

.auth-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 3.5rem 3rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    max-width: 420px;
    width: 90%;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.auth-logo {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--sidebar-active) 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.auth-container h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.auth-container p {
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.auth-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border-light);
    border-top-color: var(--sidebar-active);
    border-right-color: var(--sidebar-active);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
    position: relative;
}

.auth-spinner::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sidebar-active) 0%, #6366f1 100%);
    opacity: 0.2;
}

.auth-container button.btn-primary {
    margin-top: 1.5rem;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--sidebar-active) 0%, #6366f1 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 6px -1px rgba(67, 56, 202, 0.3);
}

.auth-container button.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(67, 56, 202, 0.4);
}

.auth-container button.btn-primary:active {
    transform: translateY(0);
}
.user-info {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-right: 0.75rem;
}
