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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1a1a1a;
    line-height: 1.6;
    background: #f8f9fa;
}

header {
    background: white;
    color: #1a1a1a;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

nav h1 {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    flex: 0 0 auto;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

nav a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

nav a:hover {
    color: #2563eb;
}

.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('https://images.unsplash.com/photo-1552664730-d307ca884978?w=1200&h=400&fit=crop') center/cover no-repeat;
    color: white;
    padding: 8rem 2rem;
    text-align: center;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero h2 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #e8e8e8;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
}

.btn {
    display: inline-block;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.courses {
    max-width: 1200px;
    margin: 5rem auto;
    padding: 0 2rem;
}

.courses h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 3rem;
    color: #1a1a1a;
    font-weight: 700;
}

.course-grid {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}

.course-grid .course-card {
    flex: 0 0 300px;
    scroll-snap-align: start;
}

.courses-inner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.course-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.scroll-btn {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    border: none;
    min-width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.3s;
}

.scroll-btn:hover {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.scroll-btn:disabled { 
    opacity: 0.4; 
    cursor: default; 
}

@media (max-width: 768px) {
    .courses-inner { flex-direction: column; }
    .controls { flex-direction: row; justify-content: flex-end; margin-left: 0; gap: 0.5rem; }
    .scroll-btn { min-width: 36px; height: 36px; }
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.course-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
}

.course-content {
    padding: 1.5rem;
}

.course-content h3 {
    margin-bottom: 0.5rem;
    color: #2563eb;
    font-weight: 700;
    font-size: 1.1rem;
}

.course-content p {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.course-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.course-btn {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: box-shadow 0.3s, transform 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
}

.course-btn:hover {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transform: translateY(-2px);
}
.course-btn.disabled {
    opacity: 0.6;
    pointer-events: none;
    cursor: default;
}

.create-card { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-height: 280px; 
    cursor: pointer;
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f4f8 100%);
    border: 2px dashed #2563eb;
}

.create-card .course-content { 
    text-align: center; 
}

.create-card h3 {
    color: #2563eb;
}

.card-delete { 
    position: absolute; 
    top: 8px; 
    right: 8px; 
    background: rgba(255, 255, 255, 0.9); 
    border: none; 
    border-radius: 50%; 
    width: 36px; 
    height: 36px; 
    font-size: 1.5rem; 
    color: #ef4444; 
    cursor: pointer; 
    transition: background 0.2s; 
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-delete:hover { 
    background: rgba(255, 255, 255, 1); 
}

.modal { 
    position: fixed; 
    inset: 0; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: rgba(0, 0, 0, 0.6); 
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal.hidden { 
    display: none; 
}

.modal-content { 
    background: white; 
    padding: 2rem; 
    border-radius: 12px; 
    width: min(520px, 95%); 
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 { 
    margin-top: 0; 
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-content label { 
    display: block; 
    margin-bottom: 1rem; 
    font-size: 0.9rem; 
    color: #1a1a1a;
    font-weight: 600;
}
.modal-content .hint { font-size: 0.8rem; color: #666; margin-top: 4px; display: block; }

.modal-content input[type="text"], 
.modal-content input[type="url"], 
.modal-content textarea { 
    width: 100%; 
    padding: 10px 12px; 
    border: 1px solid #e5e7eb; 
    border-radius: 6px; 
    box-sizing: border-box;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="url"]:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-close { 
    background: none; 
    border: none; 
    font-size: 1.5rem; 
    float: right; 
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #1a1a1a;
}

footer {
    background: white;
    color: #666;
    text-align: center;
    padding: 2rem;
    margin-top: 5rem;
    border-top: 1px solid #e5e7eb;
}

footer p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    nav {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    nav h1 {
        font-size: 1.1rem;
        flex: 1 1 100%;
        order: -1;
    }

    nav ul {
        gap: 0.5rem;
        flex: 1 1 100%;
        justify-content: flex-start;
        order: 2;
    }

    nav a {
        font-size: 0.8rem;
        padding: 4px 6px;
    }

    .nav-actions {
        flex: 1 1 100%;
        order: 1;
        gap: 4px;
    }

    #global-search {
        width: 140px;
        padding: 6px 8px;
        font-size: 0.85rem;
    }

    .filter-toggle {
        padding: 5px 8px;
        font-size: 0.75rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .courses h2 {
        font-size: 1.5rem;
    }
}

/* Bottom centered creator */
.bottom-creator {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 18px;
    z-index: 10000;
}

.bottom-block-select {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.95rem;
}

/* Search & filters */
.nav-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex: 0 0 auto;
}

#global-search {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    width: 200px;
    font-size: 0.9rem;
}

.filter-toggle {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    flex: 0 0 auto;
}

.filter-bar {
    max-width: 1200px;
    margin: 1rem auto;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 2rem;
    flex-wrap: wrap;
}

.filter-control label { font-weight: 600; font-size: 0.9rem; display: block; }
.filter-control input, .filter-control select { padding: 6px 8px; border-radius: 8px; border: 1px solid #e5e7eb; }

.card-meta { font-size: 0.85rem; color: #666; margin-top: 8px; display:flex; gap:8px; flex-wrap:wrap; }
.card-meta .meta-item { background: #f3f4f6; padding: 4px 8px; border-radius: 999px; }

@media (max-width: 480px) {
    nav {
        padding: 0 0.5rem;
        gap: 0.3rem;
    }

    nav h1 {
        font-size: 0.95rem;
    }

    nav ul {
        gap: 0.4rem;
    }

    nav a {
        font-size: 0.75rem;
        padding: 3px 4px;
    }

    .nav-actions {
        gap: 3px;
    }

    #global-search {
        width: 100px;
        padding: 5px 6px;
        font-size: 0.8rem;
    }

    .filter-toggle {
        padding: 4px 6px;
        font-size: 0.7rem;
    }

    .bottom-creator { gap: 6px; padding: 6px 8px; bottom: 12px; }
    .bottom-block-select { display: none; }
    .filter-bar { padding: 0 12px; gap: 8px; }
}

/* Ajustement du bouton de suppression : plus petit, circulaire et accessible */
.courses-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 auto 1.5rem;
    max-width: 1200px;
    padding: 0 2rem;
    position: relative;
}

.courses-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.volet-delete {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.12);
    color: #ef4444;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
    flex: 0 0 auto;
}

.volet-delete:hover {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 6px 18px rgba(239,68,68,0.12);
    transform: translateY(-2px);
}

.volet-delete:focus-visible {
    outline: 3px solid rgba(239,68,68,0.15);
    outline-offset: 3px;
}

@media (max-width: 480px) {
    .courses-header { gap: 6px; padding: 0 12px; }
    .volet-delete { width: 34px; height: 34px; font-size: 1rem; }
    .courses-header h2 { font-size: 1.25rem; text-align: center; white-space: normal; }
}
