/* =========================
   HEADER GLOBAL
========================= */

.top-header {
    background: #ffffff;
    border-bottom: 1px solid #eee;
}

.header-inner {
    max-width: 1200px;
    margin: auto;
    padding: 18px 20px;

    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

.search-inline {
    margin-top: 20px;

    display: flex;
    align-items: center;
    gap: 12px;
}

.search-inline input {
    flex: 1;
    min-width: 220px;
}

.search-inline button {
    padding: 10px 16px;
}



/* =========================
   GLOBAL
========================= */

body {
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    margin: 0;
    padding: 30px;
    color: #111;
}

h1, h2, h3 {
    margin: 0 0 15px;
}

.table {
    table-layout: fixed;
}


/* =========================
   CONTAINERS
========================= */

.container {
    margin-top: 20px;
}

.container.narrow {
    max-width: 700px;
}

.container.full {
    max-width: 1100px;
    margin: auto;
}

.container.wide {
    max-width: 100%;
    padding: 30px;
}

/* =========================
   FLASH / MESSAGES
========================= */

.flash {
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.flash.success {
    background: #e6fffa;
    color: #065f46;
    border-left: 5px solid #10b981;
}

.flash.error,
.notice {
    background: #fff3cd;
    color: #856404;
    border-left: 5px solid #ffc107;
}

.success {
    background: #d4edda;
    border-left: 5px solid #28a745;
}

/* =========================
   BOUTONS
========================= */

.btn {
    display: inline-block;
    padding: 8px 14px;
    font-size: 14px;
    border-radius: 4px;
    border: none;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary {
    background: #007bff;
    color: #fff;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-large {
    padding: 16px 36px;
    font-size: 1.15rem;
}

/* Bouton principal (Create) */
.btn-create {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    padding: 14px 26px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
    transition: all 0.2s ease;
}

.btn-create:hover {
    transform: translateY(-2px) scale(1.03);
}

.btn-create:active {
    transform: scale(0.97);
}

/* =========================
   TABLES
========================= */

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table th,
.table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

.table th {
    background: #f0f0f0;
}

/* =========================
   BADGES / TEXTE
========================= */

.badge {
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 4px;
    background: #eaeaea;
}

.ref {
    font-family: monospace;
    font-weight: bold;
    background: #eef3ff;
    padding: 2px 6px;
    border-radius: 4px;
}

/* =========================
   CARTES MACHINES
========================= */

.machine-card {
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.machine-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment {
    color: #555;
    margin: 10px 0 15px;
}

/* =========================
   ACTIONS
========================= */

.actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.actions-inline {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* =========================
   FORMULAIRES
========================= */

.form-card {
    background: #fff;
    padding: 40px;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.06);
}

fieldset {
    border: none;
    margin-bottom: 40px;
}

legend {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

input,
textarea,
select {
    width: 100%;
    padding: 14px;
    font-size: 0.95rem;
    border-radius: 10px;
    border: 1px solid #ccc;
    margin-top: 6px;
}

/* Grilles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 32px;
}

/* =========================
   PIÈCES
========================= */

.piece-block {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: grid;
    gap: 10px;
}

.piece-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 6px;
    border-bottom: 1px solid #eee;
}

.piece-actions a {
    margin-left: 10px;
    text-decoration: none;
}

/* =========================
   HEADER STICKY
========================= */

.top-header.sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #eee;
}

.header-inner {
    max-width: 1200px;
    margin: auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo-text {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: .45;
    white-space: nowrap;
}

.search-inline {
    flex: 1;
    display: flex;
    gap: 10px;
}

.search-inline input {
    flex: 1;
    padding: 12px 14px;
    border-radius: 6px;
}

.search-inline button {
    padding: 12px 18px;
    border-radius: 6px;
    background: #111;
    color: #fff;
    border: none;
    cursor: pointer;
}

/* =========================
   RESPONSIVE
========================= */

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

/* ===== Commentaires longs ===== */
.comment {
    color: #555;
    margin: 8px 0 12px;
    line-height: 1.4;

    /* limite visuelle */
    max-height: 4.2em;          /* ~3 lignes */
    overflow: hidden;

    /* coupe proprement le texte */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* =========================
   TABLE FIXE
========================= */

.table {
    table-layout: fixed;
    width: 100%;
}

/* =========================
   COLONNE COMMENTAIRE
========================= */

.comment-cell {
    width: 35%;
    max-width: 35%;
    vertical-align: top;
}

.comment-table {
    display: block;
    max-height: 4.2em; /* ~3 lignes */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.4;
    font-size: 0.9rem;
    color: #555;
}

/* =========================
   COLONNE ACTIONS
========================= */

.actions-cell {
    width: 110px;
    min-width: 110px;
    max-width: 110px;
    white-space: nowrap;
    text-align: center;
}

.table {
    table-layout: fixed;
    width: 100%;
}

/* commentaire */
.comment-table {
    max-height: 4.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    font-size: 0.9rem;
    color: #555;
}

/* actions */
.actions-cell {
    text-align: center;
    white-space: nowrap;
}

/* =========================
   RÉFÉRENCES PIÈCES
========================= */

.ref {
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: 600;

    background: #eef3ff;
    color: #1e3a8a;

    padding: 3px 8px;
    border-radius: 6px;

    display: inline-block;
    white-space: nowrap;
}

/* =========================
   BOUTON CREATE - VERSION SMALL
========================= */

.btn-create.small {
    padding: 10px 20px;
    font-size: 0.95rem;
    gap: 6px;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.btn-create.small:hover {
    transform: translateY(-1px) scale(1.02);
}

.btn-create.small:active {
    transform: scale(0.98);
}

.btn-create {
    text-decoration: none;
}
