/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Sections */
.section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
}

/* IO Grid */
.io-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

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

.io-card {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 25px;
}

.io-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text);
}

.io-card p {
    color: var(--text-muted);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 10px;
    font-style: italic;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    background: #f1f5f9;
}

.drop-zone:hover {
    border-color: var(--primary);
    background: #e0f2fe;
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: #e0f2fe;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.drop-zone .icon {
    font-size: 2rem;
}

#fileName {
    color: var(--text-muted);
    font-size: 0.9rem;
    word-break: break-all;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f1f5f9;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.export-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Manual Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--surface);
    transition: all 0.2s ease;
}

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

.form-group input::-webkit-outer-spin-button,
.form-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group.is-coulissant {
    display: none;
}

.form-group.is-coulissant.visible {
    display: flex;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Results */
.results-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: #f1f5f9;
    border-radius: var(--radius);
    flex-wrap: wrap;
    gap: 10px;
}

.results-info span {
    font-weight: 500;
}

#totalCost {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
}

.table-container {
    overflow-x: auto;
}

#resultsTable {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

#resultsTable th,
#resultsTable td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#resultsTable th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#resultsTable tr:hover {
    background: #f8fafc;
}

#resultsTable .empty-state td {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* Actions */
.action-btn {
    padding: 4px 8px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.action-btn.delete {
    background: #fee2e2;
    color: var(--danger);
}

.action-btn.delete:hover {
    background: #fecaca;
}

/* Tarifs */
.tarifs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.tarifs-card {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 20px;
}

.tarifs-card h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.tarifs-table {
    width: 100%;
}

.tarifs-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

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

.tarifs-table td:first-child {
    font-weight: 500;
}

.tarifs-table td:last-child {
    text-align: right;
    font-weight: 500;
    color: var(--primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

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

.toast.success {
    background: var(--success);
}

.toast-message {
    font-weight: 500;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.loading-overlay p {
    color: white;
    margin-top: 15px;
    font-weight: 500;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .section {
        padding: 20px;
    }
    
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 640px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .section h2 {
        font-size: 1.2rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    #resultsTable th,
    #resultsTable td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .results-info {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Print Styles */
@media print {
    .section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .btn,
    .drop-zone,
    .form-actions,
    .export-options,
    .toast,
    .loading-overlay {
        display: none !important;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}
