/* =========================
   1. VARIABLES
========================= */

:root {
    --bg: #f6f3f1;
    --white: #ffffff;
    --white-soft: #faf8f7;

    --text: #2f3440;
    --text-soft: #66707d;

    --primary: #7a9a8b;
    --primary-hover: #658577;

    --border: #e5ded8;
    --border-dark: #cfc7c1;

    --success: #4f7a63;
    --error: #b35d5d;

    --radius: 16px;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}

/* =========================
   2. BASE
========================= */

body {
    background: var(--bg);
    color: var(--text);
}

.st-app-wrap {
    max-width: 1120px;
    margin: 0 auto 50px;
    background: var(--white);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.st-hidden {
    display: none !important;
}

.st-muted,
.st-message-info {
    color: var(--text-soft);
}

/* =========================
   3. TITRES
========================= */

.st-section-title {
    margin: 0 0 10px;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.st-subsection-title,
.st-section-subtitle {
    margin: 0 0 14px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.st-app-name {
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.st-history-intro {
    margin: 0;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.6;
}

/* =========================
   4. BLOCS / CARTES
========================= */

.st-card,
.st-form-card,
.st-stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.st-card,
.st-stat-card {
    padding: 22px;
    margin-bottom: 24px;
}

.st-form-card {
    max-width: 760px;
    margin: 16px auto 0;
    padding: 24px;
}

/* =========================
   5. TOOLBAR
========================= */

.st-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.st-toolbar-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* =========================
   6. BOUTONS
========================= */

.st-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    transition: 0.2s ease;
    box-sizing: border-box;
}

.st-btn:hover {
    transform: translateY(-1px);
}

.st-btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.st-btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.st-btn-secondary {
    background: var(--white);
    border-color: var(--border-dark);
    color: var(--text);
}

.st-btn-secondary:hover {
    background: var(--white-soft);
}

.st-btn-soft {
    background: #f4f1ef;
    border-color: var(--border-dark);
    color: var(--text-soft);
    min-height: 38px;
    padding: 8px 12px;
    font-size: 14px;
}

.st-btn-soft:hover {
    background: #ebe7e4;
    color: var(--text);
}

.st-btn-danger {
    background: #f3e4e4;
    border-color: #dfc3c3;
    color: #7d4a4a;
}

.st-btn-danger:hover {
    background: #ead2d2;
}

.st-btn:disabled,
.st-btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* =========================
   7. FORMULAIRES
========================= */

.st-form-group {
    margin-bottom: 18px;
}

.st-form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 600;
}

.st-input,
.st-select,
.st-file,
textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--white);
    color: var(--text);
    font-size: 15px;
    box-sizing: border-box;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.st-input:focus,
.st-select:focus,
.st-file:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(122, 154, 139, 0.14);
}

/* =========================
   8. PROFIL
========================= */

.st-profile-avatar-preview,
.st-public-avatar {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 999px;
    display: block;
    border: 1px solid var(--border);
}

.st-profile-avatar-placeholder,
.st-avatar,
.st-public-avatar-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ece7e2;
    color: var(--text-soft);
    border: 1px solid var(--border);
    font-size: 13px;
}

.st-share-box {
    background: var(--white-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
}

/* =========================
   9. STATS
========================= */

.st-stat-label {
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 8px;
    font-weight: 600;
}

.st-stat-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
}

.st-stat-meta {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 14px;
}

/* =========================
   10. TABLEAU
========================= */

.st-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
}

.st-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.st-table th {
    background: var(--white-soft);
    color: #4a5563;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    padding: 15px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.st-table td {
    padding: 16px 14px;
    border-bottom: 1px solid #eee8e3;
    vertical-align: middle;
    font-size: 15px;
}

.st-table tbody tr:nth-child(even) td {
    background: #fcfbfa;
}

.st-table tbody tr:hover td {
    background: #f2f6f4;
}

.st-table tbody tr:last-child td {
    border-bottom: none;
}

.st-table td:first-child,
.st-table th:first-child {
    width: 52px;
    text-align: center;
}

.st-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.st-table td:nth-child(2) {
    white-space: nowrap;
    color: #4a5563;
}

.st-table td:nth-child(3) {
    font-weight: 600;
}

.st-table td:nth-child(4) {
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

.st-table td:nth-child(5) {
    width: 110px;
}

.st-table img,
.st-history-thumb,
.st-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #ddd6d1;
    display: block;
    background: #fff;
}

.st-action-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.st-action-stack .st-btn {
    min-width: 110px;
    justify-content: center;
}

/* =========================
   11. PAGINATION
========================= */

.st-history-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.st-static-badge {
    cursor: default;
}

/* =========================
   12. GRAPHE
========================= */

.st-chart-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    height: 360px;
    margin-top: 20px;
    margin-bottom: 24px;
}

/* =========================
   13. COMPARAISON
========================= */

.st-compare-wrap {
    max-width: 760px;
    margin: 0 auto;
}

.st-compare-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.st-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.st-compare-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.st-compare-head {
    margin-bottom: 10px;
}

.st-compare-label {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.st-compare-meta {
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.5;
}

.st-compare-stage {
    position: relative;
    width: 100%;
    min-height: 420px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--white-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.st-compare-image,
.st-compare-stage img {
    display: block;
    max-width: 100%;
    max-height: 520px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.st-compare-canvas,
.st-compare-stage canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.st-compare-angle-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    background: rgba(47, 52, 64, 0.82);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 999px;
}

.st-compare-angle {
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    margin-top: 10px;
}

.st-compare-diff {
    margin: 16px 0 18px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

/* =========================
   14. LIGHTBOX
========================= */

#st-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#st-lightbox-stage {
    position: relative;
    width: 90vw;
    height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#st-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease;
    transform-origin: center center;
    cursor: zoom-in;
}

#st-lightbox-img.st-zoomed {
    cursor: zoom-out;
}

#st-lightbox-canvas {
    position: absolute;
    pointer-events: none;
}

#st-lightbox-close,
.st-lightbox-nav {
    position: absolute;
    z-index: 20;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
}

#st-lightbox-close {
    top: 16px;
    right: 16px;
    font-size: 22px;
}

.st-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#st-lightbox-prev {
    left: 16px;
}

#st-lightbox-next {
    right: 16px;
}

#st-lightbox-close:hover,
.st-lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.75);
}

/* =========================
   15. MESSAGES
========================= */

.st-message-success,
.st-message-error {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.st-message-success {
    color: var(--success);
    background: #edf6f0;
    border: 1px solid #d9eadf;
}

.st-message-error {
    color: var(--error);
    background: #fbefef;
    border: 1px solid #f0d7d7;
}

/* =========================
   16. VIEWERS / DÉTAIL / MESURE
========================= */

.st-viewer {
    position: relative;
    text-align: center;
}

.st-viewer img {
    max-width: 100%;
    border-radius: 10px;
}

.st-viewer canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.st-detail-viewer {
    position: relative;
    text-align: center;
    margin-top: 20px;
}

.st-detail-viewer img {
    max-width: 100%;
    border-radius: 10px;
}

#st-detail-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.st-angle-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: bold;
}

.st-detail-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
    color: white;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 50%;
}

.st-prev {
    left: 10px;
}

.st-next {
    right: 10px;
}

.st-measure-container {
    position: relative;
}

#st-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* =========================
   17. CORRECTION BOUTONS HISTORIQUE
========================= */

.st-app-wrap .st-action-stack {
    display: flex !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
    gap: 8px !important;
    align-items: center !important;
}

.st-app-wrap .st-action-stack .st-btn {
    min-width: auto !important;
    width: auto !important;
    white-space: nowrap !important;
}

.st-app-wrap .st-inline-form {
    margin: 0 !important;
    display: inline-block !important;
}

.st-app-wrap .st-inline-form .st-btn {
    width: auto !important;
    white-space: nowrap !important;
}

.st-app-wrap .st-table td:last-child {
    min-width: 260px;
}

/* =========================
   18. GUIDAGE / BLOCS D'AIDE
========================= */

.st-history-header {
    text-align: center;
    margin: 0 0 12px !important;
    padding: 0 !important;
}

.st-history-help-box {
    background: var(--white-soft);
    border: 1px solid var(--border-dark);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: none;
    text-align: center;
}

.st-history-help-title {
    font-size: 18px;
    margin-bottom: 10px;
    text-align: center;
}

.st-history-help-list,
.st-measure-help-list {
    max-width: 520px;
    margin: 12px auto 12px auto;
    padding-left: 22px;
    text-align: left;
}

.st-history-help-list li,
.st-measure-help-list li,
.st-history-help-box ol li {
    margin: 0 0 8px 0;
    padding-left: 2px;
    line-height: 1.5;
}

.st-history-help-box ol {
    max-width: 520px;
    margin: 12px auto 12px auto;
    padding-left: 22px;
    text-align: left;
}

.st-history-help-action .st-btn {
    font-size: 16px;
    padding: 12px 18px;
    font-weight: 600;
}

.st-history-filter {
    margin-top: 20px;
}

.st-history-filter-help,
.st-history-subhelp {
    margin-top: 5px;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.5;
}

.st-history-subhelp {
    text-align: center;
}

.st-empty-state {
    text-align: center;
    padding: 30px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: var(--white-soft);
}

.st-empty-state-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.st-empty-state-text {
    margin-bottom: 15px;
    color: var(--text-soft);
}

/* =========================
   19. LIEN AIDE PHOTO
========================= */

.st-help-link {
    display: inline-block;
    margin-top: 6px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s ease;
}

.st-help-link:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* =========================
   20. HEADER DU SITE : GARDER LE MENU, ENLEVER LE BRANDING
========================= */

.site-branding,
.site-title,
.site-description,
.site-identity,
.custom-logo-link,
.branding-container,
.site-header-row-container-inner .site-branding {
    display: none !important;
}

.site-header-row-container-inner,
.site-main-header-inner-wrap,
.site-header-row-layout-contained {
    min-height: auto !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.site-header-row-container-inner > .site-header-section-left:empty,
.site-header-row-container-inner > .site-header-section-center:empty {
    display: none !important;
}

/* =========================
   21. BARRE ADMIN WORDPRESS
========================= */

#wpadminbar {
    display: none !important;
}

html,
html body,
body.admin-bar {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

@media screen and (max-width: 782px) {
    html,
    html body,
    body.admin-bar {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

/* =========================
   22. SUPPRESSION HERO / TITRE KADENCE
========================= */

.entry-hero.page-hero-section,
.page-hero-section,
.page-hero-section .entry-hero-container-inner,
.entry-hero.page-hero-section .entry-header {
    display: none !important;
    border: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* =========================
   23. RÉDUCTION DES ESPACES HAUTS SUR LES PAGES APP
========================= */

.content-area {
    margin-top: 0 !important;
}

.site-main {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.entry-content-wrap {
    padding-top: 0 !important;
}

.entry-content {
    margin-top: 0 !important;
}

.page-id-2181 .content-area,
.page-id-2175 .content-area {
    margin-top: 0 !important;
    margin-bottom: 3rem !important;
}

.page-id-2181 .content-container,
.page-id-2175 .content-container {
    padding-top: 0 !important;
}

.page-id-2181 .site-main,
.page-id-2175 .site-main {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.page-id-2181 .entry-content-wrap,
.page-id-2175 .entry-content-wrap {
    padding-top: 0 !important;
}

.page-id-2181 .entry-content,
.page-id-2175 .entry-content {
    margin-top: -35px !important;
}

.page-id-2181 .st-history-header:first-child,
.page-id-2175 .st-history-header:first-child {
    margin-top: 0 !important;
    margin-bottom: 18px !important;
}

.page-id-2181 .st-history-header,
.page-id-2175 .st-history-header {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.page-id-2181 .st-app-wrap,
.page-id-2175 .st-app-wrap,
.page-id-2175 .st-new-measure-page {
    margin-top: 10px !important;
}

.page-id-2175 .st-app-wrap.st-new-measure-page {
    padding-top: 20px !important;
}

/* =========================
   24. MOBILE
========================= */

@media (max-width: 900px) {
    .st-app-wrap {
        padding: 22px;
    }

    .st-section-title {
        font-size: 28px;
    }

    .st-subsection-title,
    .st-section-subtitle {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .st-app-wrap {
        padding: 18px;
        border-radius: 16px;
    }

    .st-card,
    .st-form-card,
    .st-stat-card {
        padding: 18px;
    }

    .st-btn {
        width: 100%;
    }

    .st-toolbar-actions {
        width: 100%;
    }

    .st-table th,
    .st-table td {
        padding: 12px 10px;
        font-size: 14px;
    }

    .st-table img,
    .st-history-thumb,
    .st-thumb {
        width: 58px;
        height: 58px;
    }

    .st-action-stack .st-btn {
        min-width: 96px;
        font-size: 13px;
    }

    .st-compare-grid {
        grid-template-columns: 1fr;
    }

    .st-compare-stage {
        min-height: 300px;
        height: auto;
    }

    .st-compare-image {
        max-height: 360px;
    }

    .st-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 26px;
    }

    #st-lightbox-prev {
        left: 10px;
    }

    #st-lightbox-next {
        right: 10px;
    }

    #st-lightbox-close {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .st-app-wrap .st-action-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .st-app-wrap .st-action-stack .st-btn,
    .st-app-wrap .st-inline-form .st-btn {
        width: 100% !important;
    }

    .st-app-wrap .st-table td:last-child {
        min-width: 180px;
    }
}

.st-history-subhelp {
    margin: 12px 0 0 0;
    text-align: left;
}

.st-profile-avatar-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    background: #ece7e2;
    color: var(--text-soft);
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.3;
}

#st-lightbox {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.88);
	z-index: 9999;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

#st-lightbox-stage {
	position: relative;
	width: 90vw;
	height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

#st-lightbox-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	display: block;
	object-fit: contain;
	border-radius: 12px;
}

#st-lightbox-canvas {
	position: absolute;
	pointer-events: none;
}