/* ===== IMPORT GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== VARIABLES CSS ===== */
:root {
    --primary-color: #2d6cdf;
    --secondary-color: #1b2430;
    --accent-color: #3e8ed0;
    --success-color: #3bb273;
    --warning-color: #f7b731;
    --error-color: #e74c3c;

    --priority-high: #e74c3c;
    --priority-medium: #f7b731;
    --priority-low: #3e8ed0;

    --bg-color: #f5f6fa;
    --card-bg: #fff;
    --card-hover: #f0f2f5;

    --text-primary: #1b2430;
    --text-secondary: #495464;
    --text-muted: #a0a4b8;

    --border-color: #e0e6ed;
    --border-light: #f0f2f5;
    --shadow: 0 4px 24px rgba(44, 62, 80, 0.07);
    --shadow-hover: 0 8px 32px rgba(44, 62, 80, 0.12);

    --gradient-primary: none;
    --gradient-secondary: none;
    --gradient-accent: none;
}

/* ===== RESET ET BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    background-image: none;
}

/* ===== LAYOUT FIXES ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    z-index: 1;
}
.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}
.left-panel {
    min-width: 340px;
    max-width: 400px;
    flex: 1 1 340px;
}
.right-panel {
    flex: 2 1 0;
    min-width: 0;
}
.card {
    margin-bottom: 0;
    z-index: 2;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}
section.card:not(:last-child) {
    margin-bottom: 0;
}

/* Prevent overlap and ensure scrollable content fits */
.tasks-list, .timeline {
    max-width: 100%;
    min-width: 0;
    word-break: break-word;
    background: transparent;
}

/* Ensure no element is hidden by mistake */
.card, .tasks-list, .timeline, .left-panel, .right-panel {
    display: block;
    visibility: visible;
    opacity: 1;
}

/* ===== DARK MODE ===== */
body.dark-mode {
    --bg-color: #181c24;
    --card-bg: #232a36;
    --card-hover: #232a36;
    --text-primary: #f5f6fa;
    --text-secondary: #bfc9d1;
    --text-muted: #7a869a;
    --border-color: #232a36;
    --border-light: #232a36;
    --shadow: 0 4px 24px rgba(0,0,0,0.25);
    --shadow-hover: 0 8px 32px rgba(0,0,0,0.35);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #232a36 !important;
    color: #f5f6fa !important;
    border-color: #495464 !important;
}
body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    background: #232a36 !important;
    color: #fff !important;
    border-color: #2d6cdf !important;
}
body.dark-mode .card {
    background: #232a36;
    color: #f5f6fa;
}
body.dark-mode .btn-secondary {
    background: #232a36;
    color: #f5f6fa;
    border-color: #2d6cdf;
}
body.dark-mode .btn-secondary:hover, body.dark-mode .btn-secondary:focus {
    background: #2d6cdf;
    color: #fff;
}
body.dark-mode .btn-primary {
    background: #2d6cdf;
    color: #fff;
}
body.dark-mode .btn-danger {
    background: #e74c3c;
    color: #fff;
}
body.dark-mode .btn-danger:hover, body.dark-mode .btn-danger:focus {
    background: #c0392b;
}
body.dark-mode .tasks-list, body.dark-mode .timeline {
    background: transparent;
}
body.dark-mode .priority-badge.high {
    background: #3a2323;
    color: #e74c3c;
    border-color: #e74c3c;
}
body.dark-mode .priority-badge.medium {
    background: #3a3623;
    color: #f7b731;
    border-color: #f7b731;
}
body.dark-mode .priority-badge.low {
    background: #232a36;
    color: #3e8ed0;
    border-color: #3e8ed0;
}

/* ===== REMOVE FOCUS MODE ===== */
body.focus-mode .header,
body.focus-mode .footer,
body.focus-mode .data-card,
body.focus-mode .add-task-card,
body.focus-mode .container {
    display: initial !important;
    margin-top: initial !important;
    padding-top: initial !important;
}

/* ===== HEADER STYLÉ ===== */
.header {
    background: var(--primary-color);
    padding: 2.2rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.header::before { display: none; }
.header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
    text-shadow: none;
    letter-spacing: 0.01em;
}
.header p {
    font-size: 1.1rem;
    color: #e0e6ed;
    font-weight: 400;
}
.header-decoration { display: none; }

.decoration-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: bounce 2s infinite ease-in-out;
}

.decoration-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.decoration-dot:nth-child(3) {
    animation-delay: -0.32s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    } 40% {
        transform: scale(1);
    }
}

.footer {
    background: var(--bg-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    z-index: 1;
}
.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}
.left-panel {
    min-width: 340px;
    max-width: 400px;
    flex: 1 1 340px;
}
.right-panel {
    flex: 2 1 0;
    min-width: 0;
}

/* ===== CARTES STYLÉES ===== */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    z-index: 2;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.card:hover::before {
    transform: translateX(0);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    background: var(--card-hover);
}

/* Cartes spécialisées */
.config-card {
    border: 2px solid var(--border-light);
}

.add-task-card::before {
    background: var(--gradient-secondary);
}

.planning-card::before {
    background: var(--gradient-accent);
}

.tasks-card {
    border: 2px solid var(--secondary-color);
}

.card h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== FORMULAIRES STYLÉS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.9rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(45, 108, 223, 0.08);
}

.form-group input::placeholder {
    color: var(--text-muted);
    font-style: normal;
}


/* ===== ALIGNEMENT TEMPS ===== */
.time-config {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.time-align-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* ===== BOUTONS ===== */
.btn {
    padding: 0.9rem 1.3rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    text-decoration: none;
    position: relative;
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
}
.btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.btn-primary {
    background: var(--primary-color);
    color: #fff;
}
.btn-secondary {
    background: #fff;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
}
.btn-secondary:hover, .btn-secondary:focus {
    background: var(--primary-color);
    color: #fff;
}
.btn-small {
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
}
.btn-danger {
    background: #e74c3c;
    color: #fff;
}
.btn-danger:hover, .btn-danger:focus {
    background: #c0392b;
}
.btn-success {
    background: #3bb273;
    color: #fff;
    border: 1.5px solid #3bb273;
}
.btn-success:hover, .btn-success:focus {
    background: #269e5e;
    color: #fff;
    border-color: #269e5e;
}

/* ===== TASK DELETE BUTTON ===== */
.task-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-delete-task {
    background: none;
    color: #e74c3c;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
.btn-delete-task:hover, .btn-delete-task:focus {
    background: #fbeaea;
    color: #c0392b;
    outline: 2px solid #e74c3c;
}

/* ===== PLANNING & TÂCHES ===== */
.timeline-item, .task-item {
    border-left: 4px solid var(--primary-color);
    background: var(--card-bg);
    color: var(--text-primary);
}
.timeline-item.priority-high, .task-item.priority-high {
    border-left-color: var(--priority-high);
}
.timeline-item.priority-medium, .task-item.priority-medium {
    border-left-color: var(--priority-medium);
}
.timeline-item.priority-low, .task-item.priority-low {
    border-left-color: var(--priority-low);
}
.timeline-time {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.timeline-title {
    font-size: 1.08rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.timeline-duration {
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.tasks-list {
    max-height: 450px;
    overflow-y: auto;
    padding-right: 0.5rem;
}
.task-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}
.task-meta {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== BADGES PRIORITÉ ===== */
.priority-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: none;
    border: 1px solid transparent;
}
.priority-badge.high {
    background: #fbeaea;
    color: var(--priority-high);
    border-color: #f5c6cb;
}
.priority-badge.medium {
    background: #fff7e6;
    color: var(--priority-medium);
    border-color: #ffeaa7;
}
.priority-badge.low {
    background: #eaf2fb;
    color: var(--priority-low);
    border-color: #b2bec3;
}

/* ===== IMPORT/EXPORT ===== */
.data-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.file-input {
    display: none;
}

/* ===== ÉTAT VIDE STYLÉ ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.empty-state p {
    font-size: 1rem;
    line-height: 1.5;
}

/* ===== ACCESSIBILITY ===== */
input:focus, select:focus, button:focus, .btn:focus, .tasks-list:focus, #timeline:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ===== ENSURE BUTTONS ARE VISIBLE ===== */
.btn, .btn-delete-task, .btn-success, .btn-secondary, .btn-primary {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
}

/* ===== ENSURE NO OVERLAP ===== */
.left-panel, .right-panel {
    position: static;
}
.card {
    position: relative;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem;
        display: flex;
    }
    .left-panel,
    .right-panel {
        min-width: 0;
        max-width: 100%;
        width: 100%;
        display: contents;
        padding: 0;
        margin: 0;
    }
    .config-card { order: 1; width: 100%; }
    .planning-card { order: 2; width: 100%; }
    .add-task-card { order: 3; width: 100%; }
    .tasks-card { order: 4; width: 100%; }
    .data-card { order: 5; width: 100%; }
    .card {
        margin-bottom: 16px;
        padding: 1.2rem;
        min-width: 0;
        width: 100%;
        border-radius: 10px;
    }
    .timeline {
        max-height: none !important;
        overflow-y: visible !important;
        margin-bottom: 1.5rem;
    }
    .tasks-list {
        max-height: 220px;
        overflow-y: auto;
    }
}

@media (max-width: 700px) {
    .container {
        padding: 0.5rem;
        gap: 1rem;
    }
    .card {
        padding: 0.8rem;
        border-radius: 10px;
    }
    .btn {
        padding: 0.7rem 1rem;
    }
    .timeline {
        max-height: none !important;
        overflow-y: visible !important;
        margin-bottom: 1.2rem;
    }
    .tasks-list {
        max-height: 160px;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.2rem 0;
    }
    .header h1 {
        font-size: 1.2rem;
    }
    .container {
        padding: 0.2rem;
    }
    .card {
        padding: 0.6rem;
        border-radius: 8px;
    }
    .btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.95rem;
    }
    .timeline {
        max-height: none !important;
        overflow-y: visible !important;
        margin-bottom: 1rem;
    }
    .tasks-list {
        max-height: 120px;
        overflow-y: auto;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-in {
    animation: slideInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== SCROLLBAR PERSONNALISÉE ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
    opacity: 0.7;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
    opacity: 1;
}

/* ===== MICRO-INTERACTIONS ===== */
.card, .btn, .task-item, .timeline-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus, select:focus {
    animation: inputFocus 0.3s ease;
}

@keyframes inputFocus {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ===== PLANNING ACTIONS BUTTONS FLEX ROW ===== */
#planningActions {
    display: flex !important;
    flex-direction: row !important;
    gap: 1rem !important;
    align-items: center;
    margin-top: 16px;
}

.task-info {
    flex: 1 1 auto;
    min-width: 0;
}
.task-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}
