/* =========================================================
   Admin - Words
   Design harmonisé avec Roots / Verbs
   ========================================================= */


/* =========================================================
   Page et en-tête
   ========================================================= */

.words-admin-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.words-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    width: 100%;
    box-sizing: border-box;

    padding: 26px 28px;

    background: #ffffff;
    border: 1px solid #dfe8ef;
    border-radius: 22px;

    box-shadow: 0 7px 20px rgba(31, 60, 90, 0.07);
}

.words-page-header-form {
    justify-content: flex-start;
}

.words-page-kicker,
.words-section-kicker {
    margin-bottom: 5px;

    color: #109c9b;

    font-size: 0.76rem;
    font-weight: 900;

    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.words-page-header h1 {
    margin: 0;

    color: #102b56;

    font-size: clamp(1.8rem, 3vw, 2.45rem);
    font-weight: 900;
    line-height: 1.1;
}

.words-page-header p {
    max-width: 800px;

    margin: 9px 0 0;

    color: #536579;

    line-height: 1.55;
}

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


/* =========================================================
   Boutons communs
   ========================================================= */

.words-primary-button,
.words-secondary-button,
.words-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    border-radius: 12px;

    font-weight: 800;
    text-decoration: none !important;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.words-primary-button {
    padding: 10px 15px;

    border: 1px solid #109c9b;

    background: #109c9b;

    color: #ffffff !important;
}

.words-primary-button:hover {
    background: #0d8988;
    border-color: #0d8988;

    transform: translateY(-1px);
}

.words-secondary-button {
    padding: 9px 14px;

    border: 1px solid #cfdce5;

    background: #ffffff;

    color: #40556b !important;
}

.words-secondary-button:hover {
    background: #f7fafc;

    transform: translateY(-1px);
}


/* =========================================================
   LISTE
   ========================================================= */

.words-list-panel {
    width: 100%;
    box-sizing: border-box;

    padding: 26px 28px;

    background: #ffffff;

    border: 1px solid #dfe8ef;
    border-radius: 22px;

    box-shadow: 0 7px 20px rgba(31, 60, 90, 0.07);
}


/* Toolbar */

.words-toolbar {
    display: grid;

    grid-template-columns:
        minmax(260px, 1.6fr)
        minmax(170px, 0.8fr)
        minmax(170px, 0.8fr)
        minmax(150px, 0.65fr)
        auto;

    align-items: end;

    column-gap: 20px;
    row-gap: 16px;

    margin-bottom: 18px;
}

.words-filter {
    min-width: 0;
}

.words-filter label {
    display: block;

    margin-bottom: 7px;

    color: #334a61;

    font-size: 0.87rem;
    font-weight: 800;
}

.words-filter input,
.words-filter select {
    width: 100%;
    box-sizing: border-box;

    padding: 10px 12px;

    border: 1px solid #cfdce5;
    border-radius: 11px;

    background: #ffffff;

    color: #20384f;

    font: inherit;
}

.words-filter input:focus,
.words-filter select:focus {
    outline: 2px solid rgba(16, 156, 155, 0.15);
    border-color: #109c9b;
}

.words-toolbar-actions {
    display: flex;
    align-items: center;
}

.words-list-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    margin-bottom: 12px;
}

.words-message-inline,
.words-count {
    color: #718196;

    font-size: 0.84rem;
    font-weight: 800;
}

.words-count {
    white-space: nowrap;
}


/* Table */

.words-table-wrapper {
    overflow-x: auto;
}

.words-table {
    width: 100%;

    border-collapse: collapse;
}

.words-table th,
.words-table td {
    padding: 14px 12px;

    border-bottom: 1px solid #e8eef3;

    text-align: left;
    vertical-align: middle;
}

.words-table th {
    color: #536579;

    font-size: 0.78rem;
    font-weight: 900;

    text-transform: uppercase;
    letter-spacing: 0.45px;
}

.words-col-level {
    width: 80px;
}

.words-col-arabic {
    width: 150px;
}

.words-col-forms {
    min-width: 300px;
}

.words-col-actions {
    width: 190px;
}

.words-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 34px;
    height: 28px;

    padding: 0 8px;

    border-radius: 999px;

    background: #edf8f8;

    color: #0c8584;

    font-size: 0.82rem;
    font-weight: 900;
}

.words-arabic-cell {
    color: #102b56;

    font-size: 1.7rem;
    font-weight: 900;

    white-space: nowrap;
}

.words-french-cell {
    color: #20384f;

    font-weight: 800;
}

.words-empty-row {
    padding: 30px !important;

    color: #718196;

    text-align: center !important;
}


/* Résumé des formes */

.words-forms-cell {
    min-width: 320px;
}

.words-form-summary {
    padding: 10px 12px;

    border: 1px solid #e0e8ee;
    border-radius: 12px;

    background: #fafcfd;
}

.words-form-summary + .words-form-summary {
    margin-top: 9px;
}

.words-form-summary.is-masculine {
    border-left: 3px solid #7ca7c8;
}

.words-form-summary.is-feminine {
    border-left: 3px solid #c58bac;
}

.words-form-summary-title {
    margin-bottom: 6px;

    color: #536579;

    font-size: 0.76rem;
    font-weight: 900;

    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.words-form-line {
    display: grid;

    grid-template-columns:
        22px
        minmax(80px, auto)
        minmax(90px, 1fr);

    gap: 8px;

    align-items: baseline;

    padding: 2px 0;
}

.words-form-kind {
    color: #8a99a8;

    font-size: 0.72rem;
    font-weight: 900;
}

.words-form-arabic {
    color: #102b56;

    font-size: 1.15rem;
    font-weight: 800;

    white-space: nowrap;
}

.words-form-french {
    color: #536579;

    font-size: 0.82rem;
}

.words-no-form {
    color: #8a99a8;

    font-size: 0.84rem;
}


/* Actions */

.words-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.words-action-button {
    padding: 7px 10px;

    border: 1px solid #d3dfe7;

    background: #ffffff;

    color: #40556b !important;

    font-size: 0.82rem;
}

.words-action-button:hover {
    background: #f6f9fb;
}

.words-action-delete {
    border-color: #f0c7c7;

    color: #a64646 !important;
}


/* =========================================================
   FORMULAIRE
   ========================================================= */

.words-form-panel {
    width: 100%;
    max-width: 1100px;

    margin-left: auto;
    margin-right: auto;

    box-sizing: border-box;

    padding: 26px 28px;

    background: #ffffff;

    border: 1px solid #dfe8ef;
    border-radius: 22px;

    box-shadow: 0 7px 20px rgba(31, 60, 90, 0.07);
}

.words-form-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 24px;
    padding-bottom: 16px;

    border-bottom: 1px solid #e8eef3;
}

.words-form-title-row h2 {
    margin: 0;

    color: #102b56;

    font-size: 1.25rem;
    font-weight: 900;
}


/* Sections */

.words-form-section {
    box-sizing: border-box;

    padding: 22px;

    background: #fbfdff;

    border: 1px solid #e2eaf0;
    border-radius: 18px;
}

.words-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
    padding-bottom: 13px;

    border-bottom: 1px solid #e8eef3;
}

.words-section-heading h3 {
    margin: 0;

    color: #102b56;

    font-size: 1.12rem;
    font-weight: 900;
}

.words-form-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1.4fr)
        minmax(0, 1fr);

    column-gap: 30px;
    row-gap: 22px;
}

.words-form-grid > * {
    min-width: 0;
}

.words-field-small {
    max-width: 180px;
}

.words-field-main {
    min-width: 0;
}


/* Masculin / Féminin */

.words-gender-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 24px;

    margin-top: 24px;
}

.words-gender-section {
    min-width: 0;
}

.words-gender-masculine {
    background: #f8fbff;
    border-color: #dce8f2;
}

.words-gender-feminine {
    background: #fff9fc;
    border-color: #eadde5;
}

.words-gender-masculine .words-section-kicker {
    color: #477ba1;
}

.words-gender-feminine .words-section-kicker {
    color: #a65f86;
}

.words-form-pair {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);

    column-gap: 18px;
    row-gap: 14px;

    padding: 16px 0;

    border-bottom: 1px solid #e8eef3;
}

.words-form-pair:first-child {
    padding-top: 0;
}

.words-form-pair:last-child {
    padding-bottom: 0;

    border-bottom: 0;
}


/* Champs */

.words-admin-page .form-row {
    min-width: 0;
    margin: 0;
}

.words-admin-page .form-row label {
    display: block;

    margin-bottom: 7px;

    color: #334a61;

    font-size: 0.86rem;
    font-weight: 800;
}

.words-admin-page .form-row input,
.words-admin-page .form-row select,
.words-admin-page .form-row textarea {
    width: 100%;
    max-width: none;
    box-sizing: border-box;

    padding: 11px 13px;

    border: 1px solid #cfdce5;
    border-radius: 11px;

    background: #ffffff;

    color: #20384f;

    font: inherit;
    line-height: 1.45;
}

.words-admin-page .form-row input:focus,
.words-admin-page .form-row select:focus,
.words-admin-page .form-row textarea:focus {
    outline: 2px solid rgba(16, 156, 155, 0.15);
    border-color: #109c9b;
}

.words-admin-page input[readonly] {
    background: #f2f5f7;

    color: #667789;
}

.words-admin-page .arabic-input {
    direction: rtl;

    padding-top: 12px;
    padding-bottom: 12px;

    color: #102b56;

    font-size: 1.45rem;
    font-family:
        "Traditional Arabic",
        "Amiri",
        "Arial",
        sans-serif;

    text-align: right;
}


/* Actions formulaire */

.words-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;

    margin-top: 28px;
    padding-top: 20px;

    border-top: 1px solid #e7edf2;
}

#formMessage {
    margin-top: 16px;
}


/* =========================================================
   Modal suppression
   ========================================================= */

#deleteModal .modal-box {
    border-radius: 18px;
}

#deleteModal .modal-box h3 {
    color: #102b56;
}


/* =========================================================
   Compatibilité anciennes vues / by-theme
   ========================================================= */

.btn-edit-word {
    border: 1px solid #31708f;

    color: #31708f;

    background: #ffffff;
}

.btn-edit-word:hover {
    background: #d9edf7;
}

.btn-delete-word {
    border: 1px solid #a94442;

    color: #a94442;

    background: #ffffff;
}

.btn-delete-word:hover {
    background: #f2dede;
}

#btnCancelEdit {
    margin-left: 10px;
}

.theme-section {
    margin-top: 35px;
}

.theme-section h3 {
    padding: 10px 15px;

    background: #34495e;

    color: #ffffff;

    border-radius: 7px;
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1200px) {

    .words-toolbar {
        grid-template-columns:
            minmax(260px, 1fr)
            repeat(3, minmax(150px, 0.7fr));

        align-items: end;
    }

    .words-toolbar-actions {
        grid-column: 1 / -1;

        justify-content: flex-end;
    }
}

@media (max-width: 1150px) {

    .words-form-panel {
        max-width: none;
    }
}

@media (max-width: 950px) {

    .words-gender-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {

    .words-toolbar,
    .words-form-grid,
    .words-form-pair {
        grid-template-columns: 1fr;
    }

    .words-toolbar-actions {
        grid-column: auto;

        justify-content: stretch;
    }

    .words-toolbar-actions > * {
        width: 100%;
    }

    .words-field-small {
        max-width: none;
    }
}

@media (max-width: 800px) {

    .words-page-header,
    .words-form-title-row,
    .words-list-status {
        align-items: stretch;
        flex-direction: column;
    }

    .words-header-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 520px) {

    .words-page-header,
    .words-list-panel,
    .words-form-panel,
    .words-form-section {
        padding: 18px;

        border-radius: 17px;
    }

    .words-header-actions,
    .words-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .words-header-actions > *,
    .words-form-actions > * {
        width: 100%;
    }

    .words-form-line {
        grid-template-columns:
            22px
            minmax(75px, auto);

        gap: 6px;
    }

    .words-form-french {
        grid-column: 2;
    }
}
