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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1;
    overflow: auto;
}

/* Cards */
.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.card-sub {
    font-size: 0.875rem;
    color: #64748b;
}

/* Gantt Chart */
.gantt-chart-wrapper {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.gantt-band {
    display: flex;
    background: #f1f5f9;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.gantt-band-cell {
    flex: 1;
    text-align: center;
}

.gantt-band-cell.primary {
    text-align: left;
    flex: 2;
}

.gantt-chart-body {
    margin-top: 1rem;
}

.gantt-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.gantt-row-label {
    flex: 2;
    font-weight: 500;
}

.gantt-line {
    flex: 3;
    height: 1rem;
    background: #e2e8f0;
    border-radius: 0.5rem;
    position: relative;
    margin: 0 1rem;
}

.gantt-bar {
    position: absolute;
    height: 100%;
    border-radius: 0.5rem;
    top: 0;
}

.gantt-legend {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.gantt-legend-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
}
/* Modern Table Styles */
.table-wrapper {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    max-width: 100%;
    padding: 1rem;
    margin-bottom: 2rem;
}

.table-wrapper table {
    min-width: 1600px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

table {
    width: 100%;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    position: sticky;
    top: 0;
    border-bottom: 2px solid #e2e8f0;
}

td {
    font-size: 0.875rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

tr {
    transition: all 0.2s ease;
}

tr:not(:last-child) td {
    border-bottom: 1px solid #f1f5f9;
}

tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

/* Status badges */
.badge-stat {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Column specific styles */
.col-ps {
    font-weight: 600;
    color: #2563eb;
}

.col-num {
    font-family: 'SF Mono', monospace;
}

.col-stat {
    min-width: 100px;
}

.col-date {
    font-family: 'SF Mono', monospace;
    color: #64748b;
}

.col-av {
    min-width: 120px;
}

.col-die {
    font-weight: 600;
}

.col-jalon {
    max-width: 200px;
    white-space: normal !important;
}

/* Progress bar */
.avancement-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avancement-bar {
    flex: 1;
    height: 0.5rem;
    background: #e2e8f0;
    border-radius: 0.25rem;
    overflow: hidden;
}

.avancement-fill {
    height: 100%;
    border-radius: 0.25rem;
    background: linear-gradient(to right, #2563eb, #4f46e5);
    transition: width 0.3s ease;
}

/* Scrollbar styling */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
/* Badges */
.badge-stat {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.badge-apd {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    border-left: 3px solid #059669;
}

.badge-etude {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    border-left: 3px solid #2563eb;
}

.badge-travaux {
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
    border-left: 3px solid #d97706;
}

/* Active row */
tr.active {
    background: rgba(37, 99, 235, 0.1) !important;
    box-shadow: inset 3px 0 0 0 #2563eb;
}

/* Sort indicators */
th.asc::after {
    content: ' ↑';
    opacity: 0.6;
}

th.desc::after {
    content: ' ↓';
    opacity: 0.6;
}
/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
    border: 1px solid #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: white;
    color: #334155;
    border: 1px solid #cbd5e1;
}

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

/* Progress Bar */
.avancement-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avancement-bar {
    flex: 1;
    height: 0.5rem;
    background: #e2e8f0;
    border-radius: 0.25rem;
    overflow: hidden;
}

.avancement-fill {
    height: 100%;
    border-radius: 0.25rem;
    background: #2563eb;
    transition: width 0.3s ease;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.modal-backdrop.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 32rem;
    padding: 1.5rem;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}

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

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

.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.color-swatch {
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-swatch.active {
    border-color: #2563eb;
}

/* Responsive */
@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }
    
    .cards-row {
        grid-template-columns: 1fr;
    }
}