/* ── Google Fonts ──────────────────────────────────────────── */

/* ── Design tokens (Default: Light Mode) ────────────────────── */
:root {
    --bg: #ffffff;
    --surface: #f4f4f7;
    --surface-2: #e8eaf0;
    --border: #d1d5db;
    --accent: #dd0e9f;
    --accent-dim: rgba(186, 12, 135, 0.10);
    --accent-hover: #b60c86;
    --teal: #0d9488;
    --teal-dim: rgba(13, 148, 136, 0.12);
    --text: #1a1d26;
    --text-muted: #4a5168;
    --text-dim: #8891a8;
    --red: #db1266;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 20px;
}

/* ── Dark Mode Preference ──────────────────────────────────── */
.icon-wraper{
    display: flex;
}

.dragAndDrop .icon{
    display: none;
}

.dragAndDrop .icon-light{
    display: block;
}



@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0f14;
        --surface: #161922;
        --surface-2: #1e2230;
        --border: #2a2f42;
        --accent: #ba0c87;
        --accent-dim: rgba(255, 107, 53, 0.10);
        --accent-hover: #aa25c5;
        --teal: #4ecdc4;
        --teal-dim: rgba(78, 205, 196, 0.12);
        --text: #e8eaf0;
        --text-muted: #8891a8;
        --text-dim: #4a5168;
        --red: #ba0c55;
    }
    .dragAndDrop .icon-light{
        display: none;
    }
    .dragAndDrop .icon-dark{
        display: block;
    }
}

/* ── Reset ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

ul,
li {
    list-style: none;
    margin: 0;
    padding: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

strong {
    color: var(--text);
}

/* ── Header ────────────────────────────────────────────────── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8%;
    height: 80px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    height: 40px;
    width: auto;
}

header nav ul {
    display: flex;
    gap: 40px;
    align-items: center;
}

header nav a {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    transition: color 0.2s;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
}

header nav a:hover {
    color: var(--text);
}

header nav a.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ── Hero (index) ──────────────────────────────────────────── */
.hero {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 60px 8%;
    position: relative;
    overflow: hidden;
}

.hero::before {
    /* Subtle layer-line texture referencing FDM print layers */
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 6px,
            rgba(255, 107, 53, 0.025) 6px,
            rgba(255, 107, 53, 0.025) 7px);
    pointer-events: none;
}

.hero-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.hero h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.9rem, 4.5vw, 3.2rem);
    font-weight: 700;
    margin: 0 0 18px;
    line-height: 1.15;
    max-width: 580px;
}

.hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 460px;
    margin: 0;
}

/* ── Main ──────────────────────────────────────────────────── */
main {
    flex: 1;
    padding: 48px 8%;
}

/* ── Two-column layout (index.php) ─────────────────────────── */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: stretch;
}

.main-form {
    display: flex;
    flex-direction: column;
}

.main-form .form-card {
    max-width: none;
    margin: 0;
    flex: 1;
}

/* ── Materials sidebar ──────────────────────────────────────── */
.main-materials {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 950px;
}

.main-materials::-webkit-scrollbar {
    width: 4px;
}
.main-materials::-webkit-scrollbar-track {
    background: transparent;
}
.main-materials::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.materials-sidebar-header {
    padding-bottom: 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.materials-sidebar-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin: 6px 0 0;
    line-height: 1.5;
}

.materials-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
}

/* Compact cards in sidebar */
.main-materials .material-card {
    padding: 16px 18px;
}

.main-materials .material-card h3 {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.main-materials .material-card p {
    font-size: 0.8rem;
    margin-bottom: 12px;
    -webkit-line-clamp: 3;
}

.main-materials .mat-tag {
    font-size: 0.58rem;
    margin-bottom: 10px;
}

.main-materials .spec-row {
    font-size: 0.75rem;
}

/* ── Responsive: stack on narrow screens ───────────────────── */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .main-materials {
        position: static;
        height: auto;
        max-height: none;
        overflow-y: visible;
    }

    .materials-sidebar-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 12px;
    }

    .main-materials .material-card {
        padding: 22px;
    }

    .main-materials .material-card h3 {
        font-size: 1rem;
    }

    .main-materials .material-card p {
        font-size: 0.85rem;
    }
}

/* ── Form card ─────────────────────────────────────────────── */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 40px;
    max-width: 680px;
    margin: 0 auto;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.consent-group {
    margin-top: 4px;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    cursor: pointer;
}

.consent-label input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--accent);
}

.consent-label a {
    color: var(--text);
    text-decoration: underline;
}

.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
}

.section-label+.section-label,
.section-spacer {
    margin-top: 32px;
}

.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
}

label .req {
    color: var(--accent);
    margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.93rem;
    padding: 11px 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.55;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-dim);
}

/* ── Drag & Drop zone ──────────────────────────────────────── */
.dragAndDrop {
    margin-top: 8px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    /* Print-bed grid — the signature element */
    border: 2px dashed var(--border);
    border-radius: var(--r-md);
    background-color: var(--bg);
    background-image:
        linear-gradient(rgba(42, 47, 66, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(42, 47, 66, 0.15) 1px, transparent 1px);
    background-size: 22px 22px;
    cursor: pointer;
    transition: border-color 0.25s, background-color 0.25s;
    user-select: none;
    position: relative;
}

.dragAndDrop:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.dragAndDrop .icon {
    width: 75px;
    height: 75px;
    opacity: 1;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}

.dropText {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--text);
    margin: 10px 0 4px;
}

.dropHint {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin: 0;
}

/* Hover / drag-over state */
.dragAndDrop.hover {
    border-color: var(--accent);
    background-color: rgba(13, 15, 20, 0.92);
    background-image:
        linear-gradient(rgba(255, 107, 53, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 107, 53, 0.08) 1px, transparent 1px);
    background-size: 22px 22px;
}

.dragAndDrop.hover .icon {
    opacity: 1;
    transform: translateY(-5px);
}

/* ── File list ─────────────────────────────────────────────── */
.file-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    text-align: left;
}

.file-ext {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--bg);
    background: var(--teal);
    border-radius: 4px;
    padding: 3px 7px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.file-info {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
    overflow: hidden;
}

.file-info strong {
    font-size: 0.83rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info small {
    font-size: 0.71rem;
    color: var(--text-muted);
}

/* ── Submit button ─────────────────────────────────────────── */
.submit-wrap {
    margin-top: 28px;
}

#submitBtn {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.97rem;
    font-weight: 600;
    padding: 14px;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.2s, transform 0.1s;
}

#submitBtn:hover:not(:disabled) {
    background: var(--accent-hover);
}

#submitBtn:active:not(:disabled) {
    transform: scale(0.99);
}

#submitBtn:disabled {
    background: var(--border);
    color: var(--text-dim);
    cursor: not-allowed;
}

/* ── Error ─────────────────────────────────────────────────── */
.dragError {
    font-size: 0.83rem;
    color: var(--red);
    text-align: center;
    margin-top: 8px;
}

.hidden {
    display: none !important;
}

/* ── Page hero (boutique / légal) ──────────────────────────── */
.page-hero {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 48px 8%;
}

.page-hero-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: var(--teal);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.page-hero h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 700;
    margin: 0 0 8px;
}

.page-hero p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    max-width: 560px;
}

/* ── Boutique grid ─────────────────────────────────────────── */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 18px;
}

.material-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 26px 22px;
    transition: border-color 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.material-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.mat-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.63rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--teal);
    background: var(--teal-dim);
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 14px;
    align-self: flex-start;
}

.mat-tag.fdm {
    color: var(--teal);
    background: var(--teal-dim);
}

.mat-tag.sla {
    color: var(--accent);
    background: var(--accent-dim);
}

.mat-tag.flex {
    color: #c084fc;
    background: rgba(192, 132, 252, 0.10);
}

.material-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px;
}

.material-card p {
    color: var(--text-muted);
    font-size: 0.87rem;
    margin: 0 0 20px;
    line-height: 1.6;
    flex: 1;
}

.mat-specs {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.spec-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.spec-row span:first-child {
    color: var(--text-dim);
}

.spec-row span:last-child {
    color: var(--text);
    font-weight: 500;
}

/* CTA boutique */
.boutique-cta {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.boutique-cta p {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    margin: 0;
}

.boutique-cta p small {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.84rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.93rem;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--r-sm);
    letter-spacing: 0.02em;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* ── Legal page ────────────────────────────────────────────── */
.legal-content {
    max-width: 700px;
    margin: 0 auto;
}

.legal-content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.03em;
    margin: 36px 0 10px;
}

.legal-content h2:first-of-type {
    margin-top: 0;
}

.legal-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.75;
    margin: 0 0 8px;
}

/* ── Footer ────────────────────────────────────────────────── */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 20px 8%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-dim);
    gap: 12px;
    flex-wrap: wrap;
}

footer a {
    transition: color 0.2s;
}

footer a:hover {
    color: var(--text-muted);
}

footer .footer-links {
    display: flex;
    gap: 24px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 680px) {
    header {
        padding: 0 5%;
        height: auto;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding-top: 14px;
        padding-bottom: 14px;
        position: static;
    }

    .logo {
        height: 32px;
    }

    header nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 20px;
    }

    header nav a {
        font-size: 0.8rem;
    }

    .hero,
    .page-hero {
        padding: 40px 5%;
    }

    main {
        padding: 28px 5%;
    }

    .form-card {
        padding: 22px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .boutique-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .admin-table td.admin-desc {
        max-width: 200px;
    }

    footer {
        padding: 20px 5%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
    }
}

/* ── Admin table ───────────────────────────────────────────── */
/* ── Admin table ───────────────────────────────────────────── */
.admin-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table th {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    background: var(--surface-2);
    position: sticky;
    top: 0;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: var(--surface-2);
}

.admin-table td.admin-desc {
    white-space: normal;
    max-width: 320px;
    color: var(--text-muted);
}

.admin-status-select {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    cursor: pointer;
    background: var(--surface-2);
    color: var(--text);
}

.admin-status-select.status-nouveau {
    background: rgba(230, 126, 34, 0.12);
    border-color: rgba(230, 126, 34, 0.4);
    color: #e67e22;
}

.admin-status-select.status-en-cours {
    background: rgba(52, 152, 219, 0.12);
    border-color: rgba(52, 152, 219, 0.4);
    color: #3498db;
}

.admin-status-select.status-terminé {
    background: rgba(46, 204, 113, 0.12);
    border-color: rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.admin-file-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.admin-file-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--teal);
    background: var(--teal-dim);
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.admin-file-link:hover {
    background: rgba(13, 148, 136, 0.22);
}

.admin-file-missing {
    font-size: 0.78rem;
    color: var(--red);
    font-style: italic;
}

.admin-alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.92rem;
}

.admin-alert.success {
    background: rgba(13, 148, 136, 0.12);
    color: var(--teal);
    border-color: rgba(13, 148, 136, 0.2);
}

.admin-delete-btn {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 8px 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.admin-delete-btn:hover {
    background: #b40f50;
}

.admin-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    padding: 60px 0;
}
/* ── Section matériaux (sous la boutique) ──────────────────── */
.materials-section {
    margin-top: 8px;
}

/* ── Lien Admin dans la nav (visible uniquement si connecté) ── */
header nav a.admin-link {
    color: var(--accent);
    background: var(--accent-dim);
    padding: 4px 12px;
    border-radius: 999px;
    border-bottom: none;
}

header nav a.admin-link:hover {
    color: var(--accent-hover);
}