:root {
    --primary-color: #0066cc;
    --secondary-color: #004080;
    --accent-color: #3399ff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #6c757d;
    --border-color: #dee2e6;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f0f4f8;
    padding-bottom: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
}

header h1 span {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.8;
    margin-left: 0.5rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-speed);
    font-size: 1.2rem;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Card Styles */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Tab Navigation Styles */
.tab-navigation {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    background-color: transparent;
    color: var(--gray-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background-color: rgba(51, 153, 255, 0.1);
    color: var(--primary-color);
}

.tab-btn.active {
    background-color: white;
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content Styles */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

section {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

section:last-child {
    border-bottom: none;
}

h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
}

h2 i {
    margin-right: 0.5rem;
    color: var(--accent-color);
}

/* Upload Section Styles */
.upload-container {
    margin-bottom: 1.5rem;
}

#drop-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: all var(--transition-speed);
}

#drop-area.highlight {
    border-color: var(--accent-color);
    background-color: rgba(51, 153, 255, 0.1);
}

#file-info {
    background-color: var(--light-color);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.progress-container {
    width: 100%;
    height: 20px;
    background-color: var(--light-color);
    border-radius: 10px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
    width: 0;
    transition: width 0.3s ease;
}

.success-message {
    color: var(--success-color);
    font-weight: 500;
    margin-bottom: 1rem;
}

/* Extraction Section Styles */
.extraction-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-end;
}

.form-group {
    flex-grow: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    color: var(--dark-color);
    background-color: white;
    outline: none;
}

select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(51, 153, 255, 0.2);
}

/* Tarif Form Styles */
.tarif-form {
    background-color: var(--light-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    color: var(--dark-color);
    background-color: white;
    outline: none;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(51, 153, 255, 0.2);
}

input[type="text"], input[type="date"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    color: var(--dark-color);
    background-color: white;
    outline: none;
}

input[type="text"]:focus, input[type="date"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(51, 153, 255, 0.2);
}

.form-actions {
    text-align: center;
    margin-top: 1.5rem;
}

.code-container {
    margin-top: 1.5rem;
    background-color: #f6f8fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}

pre {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    line-height: 1.5;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1rem;
    background-color: var(--light-color);
    padding: 1rem;
    border-radius: 8px;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
}

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

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

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

/* Utility Classes */
.hidden {
    display: none;
}

.disabled {
    opacity: 0.7;
    pointer-events: none;
}

.retry-info {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    border-left: 3px solid var(--accent-color);
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 1rem 0;
    color: var(--gray-color);
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal.hidden {
    display: none;
}

.modal:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    animation: slideIn 0.3s;
}

.modal-content.prompt-editor-modal {
    max-width: 1400px;
    width: 95%;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.modal-header h3 i {
    margin-right: 0.5rem;
    color: var(--accent-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--gray-color);
    cursor: pointer;
    transition: color var(--transition-speed);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-body.prompt-editor-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

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

.passkey-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    margin-top: 1rem;
}

.passkey-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(51, 153, 255, 0.2);
}

.error-message {
    color: var(--danger-color);
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.info-message {
    background-color: #e7f3ff;
    border-left: 3px solid var(--accent-color);
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Prompt Editor Styles */
.prompt-editor-container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.prompt-selector-pane {
    width: 350px;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    background-color: var(--light-color);
}

.prompt-selector-pane h4 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.prompt-selector-pane h5 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    font-size: 1rem;
}

.prompt-editor-pane {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.prompt-editor-pane h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.prompt-textarea {
    flex: 1;
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    resize: none;
    line-height: 1.6;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(51, 153, 255, 0.2);
}

.prompt-textarea:disabled {
    background-color: var(--light-color);
    color: var(--gray-color);
    cursor: not-allowed;
}

.editor-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: flex-start;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(51, 153, 255, 0.2);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #f0f0f0;
    color: var(--gray-color);
}

#prompt-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.prompt-item {
    padding: 0.75rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.prompt-item:hover {
    background-color: rgba(51, 153, 255, 0.1);
    border-color: var(--accent-color);
}

.prompt-item.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.prompt-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.prompt-item-llm {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.prompt-item.active .prompt-item-llm {
    opacity: 1;
}

.default-badge {
    background-color: var(--success-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.prompt-item.active .default-badge {
    background-color: white;
    color: var(--success-color);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Responsive Styles */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    header h1 span {
        font-size: 1rem;
    }
    
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    .extraction-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-group {
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn {
        width: 100%;
    }
}
