/* Entryn - CSS moderne pour desktop (exe Windows) */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;

    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

/* Dark mode */
body.dark-mode {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e3a8a;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #1f2937;
    --gray-100: #374151;
    --gray-200: #4b5563;
    --gray-300: #6b7280;
    --gray-400: #9ca3af;
    --gray-500: #d1d5db;
    --gray-600: #e5e7eb;
    --gray-700: #f3f4f6;
    --gray-800: #f9fafb;
    --gray-900: #ffffff;

    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #374151;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-width: 1024px;
    padding-bottom: 60px;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== FILE HEADER ========== */
.file-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.file-stats {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-change-file {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-change-file:hover {
    background: var(--gray-200);
    border-color: var(--primary);
}

/* ========== UPLOAD SCREEN ========== */
.upload-screen {
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.welcome-header {
    text-align: center;
    margin-bottom: 50px;
}

.welcome-header h1 {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.welcome-header p {
    font-size: 18px;
    color: var(--gray-600);
}

.upload-zone {
    width: 100%;
    max-width: 600px;
    border: 3px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 80px 40px;
    text-align: center;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.upload-text-main {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.upload-text-sub {
    color: var(--text-secondary);
    margin: 15px 0;
}

/* ========== MAIN SCREEN ========== */
.main-screen {
    padding: 15px 0;
}

/* ========== SECTION HEADERS ========== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h3 {
    font-size: 16px;
    color: var(--gray-800);
    font-weight: 600;
}

/* ========== PREVIEW COMPACT ========== */
.preview-compact {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.preview-table-wrapper {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

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

.preview-table thead {
    position: sticky;
    top: 0;
    background: var(--gray-100);
    z-index: 10;
}

.preview-table th,
.preview-table td {
    padding: 4px 8px;
    text-align: left;
    border: 1px solid var(--gray-200);
    font-size: 11px;
    line-height: 1.3;
}

.preview-table th {
    font-weight: 600;
    color: var(--gray-700);
}

.preview-table tbody tr:hover {
    background: var(--gray-50);
}

.preview-indicator {
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
    padding: 10px;
}

.btn-expand {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-expand:hover {
    background: var(--gray-200);
    border-color: var(--primary);
}

/* ========== FILTERS ========== */
.filters-toggle {
    text-align: center;
    margin-bottom: 15px;
}

.filters-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.filter-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr 2.5fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.filter-select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.filter-value-container {
    position: relative;
}

.filter-value-container .filter-select,
.filter-value-container .filter-input {
    width: 100%;
}

.filter-logic-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    position: relative;
}

.filter-logic-separator::before,
.filter-logic-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-300);
}

.filter-logic-separator::before {
    margin-right: 15px;
}

.filter-logic-separator::after {
    margin-left: 15px;
}

.filter-logic-select {
    padding: 6px 12px;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-primary);
    color: var(--primary);
    cursor: pointer;
    min-width: 80px;
    text-align: center;
}

.filter-logic-select:hover {
    background: var(--bg-secondary);
}

.filter-logic-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn-remove-filter {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
}

.btn-remove-filter:hover {
    background: #dc2626;
}

/* ========== MAPPING REQUIRED ========== */
.mapping-required {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.mapping-field {
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: all 0.2s;
}

.mapping-field:hover {
    border-color: var(--gray-300);
}

.mapping-field.required {
    border: 2px solid var(--gray-200);
}

.field-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--gray-800);
}

.field-icon {
    font-size: 20px;
}

.required-badge {
    color: var(--danger);
    font-size: 18px;
}

.field-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.field-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.field-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-example {
    color: var(--gray-500);
    font-size: 13px;
    font-style: italic;
}

.field-info {
    color: var(--gray-600);
    font-size: 14px;
    padding: 10px 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.field-info-inline {
    color: var(--gray-500);
    font-size: 12px;
    font-style: italic;
    white-space: nowrap;
}

.field-help-text {
    color: var(--gray-500);
    font-size: 12px;
    margin-top: 6px;
    font-style: italic;
}

.btn-config {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

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

/* ========== OPTIONAL FIELDS ========== */
.optional-fields-toggle {
    text-align: center;
    margin-bottom: 15px;
}

.optional-fields-panel {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    line-height: 1;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--gray-700);
}

/* ========== BUTTONS ========== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ========== FOOTER ACTIONS ========== */
.footer-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.btn-action {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-action:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.btn-export {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-export:hover {
    background: var(--success-hover);
    border-color: var(--success-hover);
}

.badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.modal-overlay.active {
    display: block;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
}

.modal.open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-small {
    width: 400px;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ========== FORM ELEMENTS ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--gray-500);
    font-size: 12px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========== PRESETS LIST ========== */
.preset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: all 0.2s;
}

.preset-item:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.preset-name {
    font-weight: 500;
    color: var(--gray-800);
}

.preset-actions {
    display: flex;
    gap: 8px;
}

.btn-preset-action {
    background: var(--bg-primary);
    border: 1px solid var(--gray-300);
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--gray-700);
}

.btn-preset-action:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-preset-load {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

.btn-preset-delete {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-preset-delete:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ========== INFO BOX ========== */
.info-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    padding: 15px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-700);
}

/* ========== EXPORT STATS ========== */
.export-downloads {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ========== FILTER ROW ========== */
.filter-row {
    display: grid;
    grid-template-columns: 150px 100px 120px 1fr 40px;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.filter-row select,
.filter-row input {
    padding: 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
}

.filter-row button {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-row button:hover {
    background: #dc2626;
}

/* ========== DARK MODE TOGGLE ========== */
.dark-mode-toggle {
    position: fixed;
    bottom: 12px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(37, 99, 235, 0.3);
}

.dark-mode-toggle svg {
    color: var(--text-primary);
    stroke: currentColor;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

.toast.toast-error {
    border-color: var(--danger);
    background: var(--bg-primary);
}

.toast.toast-success {
    border-color: var(--success);
    background: var(--bg-primary);
}

.toast.toast-warning {
    border-color: var(--warning);
    background: var(--bg-primary);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-error .toast-icon {
    color: var(--danger);
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

.toast-content {
    flex: 1;
    color: var(--text-primary);
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

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

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

/* ========== LOADING SPINNER ========== */
.upload-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== EXPORT FORMAT SELECTOR ========== */
.export-format-selector {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.export-format-selector .section-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 5px;
    margin-bottom: 20px;
}

.format-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.format-option {
    cursor: pointer;
    position: relative;
}

.format-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.format-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.format-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.format-option input[type="radio"]:checked + .format-card {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.format-name {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Dark mode */
body.dark-mode .format-card {
    background: var(--bg-primary);
}

body.dark-mode .format-option input[type="radio"]:checked + .format-card {
    background: rgba(59, 130, 246, 0.15);
}
