/**
 * AvisFiable - Styles principaux
 * Design SaaS Premium - Inspiré Stripe/Linear/Notion
 */

/* ========================================
   BASE & RESETS
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #0a0a0a;
    background-color: #fafafa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: #0a0a0a;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-muted {
    color: #666666;
}

.text-tertiary {
    color: #999999;
}

/* ========================================
   NAVIGATION
   ======================================== */

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    text-decoration: none;
}

.nav-link:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.nav-link.bg-primary\/10 {
    background-color: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

.nav-link svg {
    flex-shrink: 0;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.btn-primary:hover:not(:disabled) {
    background-color: #4338ca;
    border-color: #4338ca;
}

.btn-secondary {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.btn-danger {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

.btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.btn-ghost {
    background-color: transparent;
    color: #4f46e5;
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background-color: rgba(99, 102, 241, 0.1);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

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

.btn-icon {
    padding: 0.5rem;
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: #fafafa;
    border-top: 1px solid #f0f0f0;
    border-radius: 0 0 0.75rem 0.75rem;
}

/* ========================================
   FORMS
   ======================================== */

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #111827;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

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

.form-help {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.form-error {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: #dc2626;
}

.input-error {
    border-color: #dc2626;
}

.input-error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* File upload */
.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.15s ease;
}

.file-upload:hover {
    border-color: #4f46e5;
    background-color: rgba(99, 102, 241, 0.02);
}

.file-upload.dragover {
    border-color: #4f46e5;
    background-color: rgba(99, 102, 241, 0.05);
}

/* ========================================
   TABLES
   ======================================== */

.table-container {
    overflow-x: auto;
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem;
    background-color: #ffffff;
}

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

.table th {
    padding: 0.875rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    background-color: #fafafa;
    border-bottom: 1px solid #e5e5e5;
}

.table td {
    padding: 1rem;
    font-size: 0.875rem;
    color: #111827;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #fafafa;
}

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

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

/* ========================================
   STATS CARDS
   ======================================== */

.stat-card {
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.stat-card .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.stat-card .stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: #059669;
}

.stat-change.negative {
    color: #dc2626;
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state .empty-icon {
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    color: #9ca3af;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: #6b7280;
    max-width: 320px;
    margin-bottom: 1.5rem;
}

/* ========================================
   MODALS
   ======================================== */

.modal {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal.active .modal-panel {
    transform: scale(1);
    opacity: 1;
}

.modal-panel {
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

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

.animate-slideIn {
    animation: slideIn 0.3s ease-out;
}

/* ========================================
   UTILITIES
   ======================================== */

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .table-container {
        border: none;
        border-radius: 0;
    }
    
    .card {
        border-radius: 0.5rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
}

/* ========================================
   PAGE HEADER
   ======================================== */

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}

.page-header p {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* ========================================
   PROGRESS BAR
   ======================================== */

.progress-bar {
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background-color: #4f46e5;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* ========================================
   DROPDOWN
   ======================================== */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    min-width: 12rem;
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.15s ease;
    z-index: 50;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-top: 1px solid #e5e5e5;
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #4f46e5;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* ========================================
   SETTINGS SECTIONS
   ======================================== */

.settings-section {
    padding-bottom: 2rem;
    border-bottom: 1px solid #f0f0f0;
}

.settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.settings-section > p {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ========================================
   DEMO BANNER
   ======================================== */

.demo-banner {
    animation: pulse-subtle 3s ease-in-out infinite;
}

@keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

/* ========================================
   ALERT BOXES
   ======================================== */

.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    margin-bottom: 1rem;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* ========================================
   LOADING STATES
   ======================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e5e5e5 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.25rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 70%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
}

/* ========================================
   TOOLTIP
   ======================================== */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background-color: #1f2937;
    color: #fff;
    text-align: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ========================================
   FOCUS STATES (Accessibility)
   ======================================== */

*:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* ========================================
   PRICING CARDS
   ======================================== */

.pricing-card {
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.2s ease;
}

.pricing-card:hover {
    border-color: #4f46e5;
    box-shadow: 0 10px 40px rgba(79, 70, 229, 0.1);
}

.pricing-card.popular {
    border: 2px solid #4f46e5;
    position: relative;
}

.pricing-card.popular::before {
    content: "Populaire";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    padding: 0.25rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ========================================
   LOG ENTRIES
   ======================================== */

.log-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.875rem;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry .log-time {
    color: #6b7280;
    font-family: monospace;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.log-entry .log-action {
    font-weight: 500;
    color: #111827;
}

.log-entry .log-user {
    color: #6b7280;
    margin-left: auto;
}
