:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --sidebar-bg: #111827;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --input-bg: #0f172a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --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);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav ul li {
    margin-bottom: 0.5rem;
}

.sidebar nav ul li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.sidebar nav ul li a:hover, 
.sidebar nav ul li a.active {
    background-color: var(--card-bg);
    color: var(--text-main);
}

.sidebar nav ul li a.active {
    border-left: 4px solid var(--primary-color);
}

/* Content Area */
.content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    max-width: calc(100vw - 260px);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.main-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Update Notification */
.update-notification {
    background: #fef3c7;
    color: #92400e;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #fcd34d;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease-out;
}

.update-notification .badge-mini {
    background: rgba(146, 64, 14, 0.1);
    color: #92400e;
    border: 1px solid #92400e;
    font-size: 0.6rem;
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    vertical-align: middle;
}

.update-notification a {
    color: #92400e;
    font-weight: 600;
    text-decoration: underline;
}

.update-available-badge {
    background: var(--warning);
    color: white;
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: 4px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Grid & Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.card-header i {
    color: var(--primary-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

input, select {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

/* Profile specific styles */
.profile-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

.profile-nav {
    position: sticky;
    top: 2rem;
}

.profile-nav-list {
    list-style: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}

.profile-nav-item {
    border-bottom: 1px solid var(--border-color);
}

.profile-nav-item:last-child {
    border-bottom: none;
}

.profile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.profile-nav-link:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--text-main);
}

.profile-nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

.profile-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.profile-section.active {
    display: block;
}

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

.settings-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    overflow: hidden;
}

.settings-card-header {
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.settings-card-header i {
    color: var(--primary-color);
}

.settings-card-body {
    padding: 1.5rem;
}

.license-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.license-info-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.license-info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.license-info-value {
    font-weight: 600;
    font-size: 1rem;
}

.update-details {
    background: rgba(146, 64, 14, 0.05);
    border: 1px solid rgba(146, 64, 14, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.changelog-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.btn-update-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    background: #92400e;
    color: white;
    padding: 0.875rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    margin-top: 1.5rem;
    transition: background 0.2s;
}

.btn-update-download:hover {
    background: #78350f;
}

.badge-stable {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-beta {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid var(--warning);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.profile-avatar-placeholder {
    width: 64px;
    height: 64px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.profile-info-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.profile-info-header h3 {
    margin-bottom: 0.25rem;
}

.profile-info-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}
/* Overrides pour Choices.js theme sombre */
.choices {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.choices__inner {
    background-color: var(--input-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem !important;
    color: var(--text-main) !important;
    padding: 0.5rem 0.875rem !important;
    min-height: 42px !important;
    display: flex;
    align-items: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.choices.is-focused .choices__inner {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.choices__list--dropdown, .choices__list[aria-expanded] {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem !important;
    color: var(--text-main) !important;
    z-index: 100;
    margin-top: 4px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.choices__input {
    background-color: var(--bg-color) !important;
    color: var(--text-main) !important;
    font-size: 0.875rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 10px !important;
    margin-bottom: 0 !important;
}

.choices__list--dropdown .choices__item--selectable {
    padding: 10px 15px !important;
    transition: background-color 0.2s;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: rgba(99, 102, 241, 0.1) !important;
    color: var(--primary-color) !important;
}

.choices__list--dropdown .choices__item--selectable.is-selected {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.choices__list--dropdown .choices__item.is-disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background-color: rgba(0, 0, 0, 0.1) !important;
    text-decoration: line-through;
}

.choices[data-type*="select-one"] .choices__inner {
    padding-bottom: 0.5rem !important;
}

.choices__placeholder {
    opacity: 0.5;
    color: var(--text-muted);
}

.choices__list--single {
    padding: 0 !important;
    width: 100%;
}

.choices[data-type*="select-one"]:after {
    border-color: var(--text-muted) transparent transparent transparent !important;
    right: 15px !important;
}

.choices[data-type*="select-one"].is-open:after {
    border-color: transparent transparent var(--text-muted) transparent !important;
    margin-top: -7.5px !important;
}

input:focus, select:focus {
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

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

/* Table */
.table-responsive {
    overflow-x: auto;
}

.badge {
    background-color: var(--border-color);
    color: var(--text-main);
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

tr:hover td {
    background-color: rgba(99, 102, 241, 0.05);
}

.btn-delete {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.btn-delete:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.btn-action {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title i {
    font-size: 2rem;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.header-title h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.3s ease-out;
}

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

/* Diagram */
.diagram-card {
    margin-bottom: 1.5rem;
}

#mermaid-container {
    background: #f8fafc; /* Fond clair pour le diagramme pour lisibilité */
    padding: 1.5rem;
    border-radius: 0.5rem;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary-color);
}

.stat-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0.5rem 0;
    line-height: 1;
}

.stat-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsivité */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 2rem 0.5rem;
    }
    .sidebar-header span, .sidebar nav ul li a span, .sidebar nav ul li a i + span {
        display: none;
    }
    .sidebar nav ul li a {
        justify-content: center;
        padding: 0.75rem;
    }
    .content {
        margin-left: 80px;
        max-width: calc(100vw - 80px);
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
