/* =========================================================
   SustainChain admin page styles
   Separate from cake.css to keep project CSS clean
   ========================================================= */

:root {
    --sc-green: #52796F;
    --sc-green-dark: #354F52;
    --sc-green-soft: #DBE2DC;
    --sc-red-soft: #fff1f1;
    --sc-red: #c94a4a;
    --sc-text: #4f5d6b;
    --sc-border: #dfe5ea;
    --sc-bg-soft: #f8faf8;
}

/* =========================
   Page header / actions
   ========================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.page-header h3,
.page-header h1 {
    margin: 0;
    font-size: 2.1rem;
    color: #2f3943;
}

.page-header p {
    margin: 0.45rem 0 0;
    color: #7a8793;
    font-size: 1.45rem;
}

.page-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

/* =========================
   Buttons
   ========================= */
.button.button-secondary,
a.button.button-secondary {
    background: #eef2f5;
    border-color: #eef2f5;
    color: #4f5d6b;
}

.button.button-secondary:hover,
a.button.button-secondary:hover {
    background: #dde5eb;
    border-color: #dde5eb;
    color: #34414d;
}

.button.button-danger,
a.button.button-danger {
    background: var(--sc-red);
    border-color: var(--sc-red);
    color: #fff;
}

.button.button-danger:hover,
a.button.button-danger:hover {
    background: #b43f3f;
    border-color: #b43f3f;
    color: #fff;
}

/* =========================
   Filter card
   ========================= */
.filter-card {
    background: #ffffff;
    border: 1px solid #dce6df;
    border-radius: 8px;
    padding: 1.8rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 18px rgba(47, 62, 70, 0.05);
}

.filter-card h4,
.filter-card summary {
    margin: 0 0 1.2rem;
    font-size: 1.85rem;
    font-weight: 800;
    color: #52796F;
}

.filter-card summary {
    cursor: pointer;
    list-style-position: inside;
}

.filter-card:not([open]) summary {
    margin-bottom: 0;
}

.filter-card .row {
    gap: 1.6rem;
    margin-left: 0;
    width: 100%;
}

.filter-card .row .column {
    padding: 0;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1.2rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1.2rem;
}

.filter-actions .button,
.filter-actions button,
.filter-actions input[type="submit"],
.filter-actions input[type="reset"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 13rem;
    height: 4.6rem;
    min-height: 4.6rem;
    padding: 0 1.6rem;
    border-radius: 8px;
    font-size: 1.35rem;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.filter-actions .button,
.filter-actions button,
.filter-actions input[type="submit"] {
    background: #e5e8e6;
    color: #1f2933;
    border: 1px solid #d4ddd8;
    font-weight: 700;
}

.filter-actions .button:hover,
.filter-actions button:hover,
.filter-actions input[type="submit"]:hover {
    background: #DBE2DC;
    border-color: #cbd8d1;
    color: #1f2933;
}

.filter-actions .button-secondary,
.filter-actions a.button.button-secondary {
    background: #ff6868;
    color: #111111;
    border-color: #ff6868;
}

.filter-actions .button-secondary:hover,
.filter-actions a.button.button-secondary:hover {
    background: #e85a5a;
    border-color: #e85a5a;
    color: #111111;
}

.filter-card .input label {
    font-size: 1.55rem;
    font-weight: 800;
    color: #2F3E46;
}

.filter-card input,
.filter-card select,
.filter-card textarea {
    min-height: 4.6rem;
    border-radius: 8px;
    border: 1px solid #d4ddd8;
    background: #e5e8e6;
    box-shadow: 0 3px 8px rgba(47, 62, 70, 0.14);
    color: #1f2933;
    font-size: 1.45rem;
}

.filter-card input:focus,
.filter-card select:focus,
.filter-card textarea:focus {
    border-color: var(--sc-green);
}

/* =========================
   Data card / tables
   ========================= */
.data-card {
    border: 1px solid #dce6df;
    border-radius: 8px;
    background: #f1f8f1;
    padding: 1.2rem;
    overflow: visible;
    box-shadow: 0 4px 10px rgba(47, 62, 70, 0.18);
}

.data-card.table-responsive {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.data-card table {
    width: 100%;
    margin-bottom: 0;
    table-layout: fixed;
    border-collapse: collapse;
}

.data-card th {
    background: #f6fbf6;
    color: #2F3E46;
    font-size: 1.55rem;
    font-weight: 800;
    padding: 1.3rem 1.2rem;
}

.data-card td {
    vertical-align: top;
    color: #2f3a45;
    font-size: 1.45rem;
    font-weight: 600;
    padding: 1.4rem 1.2rem;
    overflow-wrap: anywhere;
}

.data-card tbody tr {
    background: #fbfffb;
    border-bottom: 1px solid #dce6df;
}

.data-card tbody tr:hover {
    background: #f7fff7;
}

/* =========================
   Contact forms list table
   ========================= */
.contact-forms-table {
    width: 100%;
    min-width: 1120px;
    table-layout: fixed;
}

.contact-forms-table th,
.contact-forms-table td {
    vertical-align: top;
    padding-left: 1.2rem;
    padding-right: 1.2rem;
}

.contact-forms-table th:nth-child(1),
.contact-forms-table td:nth-child(1) {
    width: 15rem;
}

.contact-forms-table th:nth-child(2),
.contact-forms-table td:nth-child(2) {
    width: 22rem;
}

.contact-forms-table th:nth-child(3),
.contact-forms-table td:nth-child(3) {
    width: 28rem;
}

.contact-forms-table th:nth-child(4),
.contact-forms-table td:nth-child(4) {
    width: 16rem;
}

.contact-forms-table th:nth-child(5),
.contact-forms-table td:nth-child(5) {
    width: 14rem;
}

.contact-forms-table th:nth-child(6),
.contact-forms-table td:nth-child(6) {
    width: 11rem;
}

.contact-forms-table th:nth-child(7),
.contact-forms-table td:nth-child(7) {
    width: 24rem;
}

.cell-muted {
    color: #7c8792;
}

.cell-name,
.cell-email,
.cell-category,
.cell-date {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.cell-message {
    max-width: 30rem;
    white-space: normal;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.cell-category {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.inline-mail-link {
    color: #335765;
    font-weight: 700;
    text-decoration: none;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.inline-mail-link:hover {
    text-decoration: underline;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 5.8rem;
    min-height: 2.8rem;
    padding: 0.35rem 0.8rem;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
}

.badge-success {
    background: #dcefe3;
    color: #2F3E46;
}

.badge-fail {
    background: #fdeaea;
    color: #b42318;
}

.badge-muted {
    background: #DBE2DC;
    color: #354F52;
}

.badge-warning {
    background: #fff7df;
    color: #9a6400;
}

.badge-danger {
    background: #fff1f1;
    color: #b43f3f;
}

.actions {
    text-align: center;
}

th.actions,
td.actions {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}

td.actions form {
    display: inline-block;
    margin: 0.25rem;
}

.actions a,
.actions .postlink-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 8.8rem;
    margin: 0.25rem;
    padding: 0 1.2rem;
    height: 4rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1;
    border: 1px solid #dbe3e9;
    background: #fff;
    color: #52616f;
    transition: 0.2s ease;
    vertical-align: middle;
}

.actions a:hover,
.actions .postlink-delete:hover {
    border-color: var(--sc-green);
    color: var(--sc-green);
    background: var(--sc-green-soft);
    text-decoration: none;
}

.actions .postlink-delete {
    background: var(--sc-red-soft);
    color: var(--sc-red);
    border-color: #f0cccc;
}

.actions .postlink-delete:hover {
    background: #ffe5e5;
    color: #a73737;
    border-color: #e7b8b8;
}

.users.index .data-card th:nth-child(1),
.users.index .data-card td:nth-child(1) {
    width: 16%;
}

.users.index .data-card th:nth-child(2),
.users.index .data-card td:nth-child(2) {
    width: 32%;
}

.users.index .data-card th:nth-child(3),
.users.index .data-card td:nth-child(3) {
    width: 16%;
    text-align: center;
}

.users.index .data-card th:nth-child(4),
.users.index .data-card td:nth-child(4) {
    width: 36%;
}

.users.index td.actions {
    vertical-align: middle;
}

.paginator {
    margin-top: 1.4rem;
    text-align: right;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #7b8792;
}

.promotion-edit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.4rem;
}

.promotion-device-section + .promotion-device-section {
    margin-top: 2.4rem;
    padding-top: 2.4rem;
    border-top: 1px solid #e1e7ea;
}

.promotion-device-heading {
    margin-bottom: 1.2rem;
}

.promotion-device-heading h4 {
    margin: 0;
    color: #52796F;
    font-size: 2rem;
    font-weight: 800;
}

.promotion-device-heading p {
    margin: 0.3rem 0 0;
    color: #657283;
    font-size: 1.2rem;
}

.promotion-upload-slot {
    min-width: 0;
}

.promotion-background-slot {
    max-width: 420px;
    margin-bottom: 1.5rem;
}

.promotion-upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
    margin-bottom: 1rem;
    border: 1px dashed #cfdad3;
    border-radius: 1.2rem;
    background: #f8faf8;
    color: #8a97a3;
    font-weight: 800;
    overflow: hidden;
}

.promotion-background-preview {
    height: 150px;
}

.promotion-upload-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* =========================
   Detail / view pages
   ========================= */
.detail-shell {
    max-width: 1280px;
    margin: 0 auto;
}

.detail-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.6rem;
}

.detail-card {
    background: #ffffff;
    border: 1px solid var(--sc-border);
    border-radius: 1.6rem;
    padding: 2.2rem;
    box-shadow:
        0 10px 24px rgba(31, 41, 55, 0.06),
        0 4px 10px rgba(31, 41, 55, 0.04);
}

.detail-card-contact-form {
    padding: 2.4rem;
}

.detail-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid #e9eef3;
}

.detail-hero-contact {
    margin-bottom: 2rem;
}

.detail-hero-main {
    max-width: 760px;
}

.detail-kicker {
    display: inline-block;
    margin-bottom: 0.65rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: #eef6f1;
    color: var(--sc-green);
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.detail-title {
    margin: 0;
    font-size: 3.2rem;
    line-height: 1.15;
    font-weight: 800;
    color: #24313d;
    letter-spacing: -0.03em;
}

.detail-subtitle {
    margin: 0.85rem 0 0;
    font-size: 1.5rem;
    line-height: 1.65;
    color: #6f7d89;
    max-width: 760px;
}

.detail-hero-side {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.contact-view-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 360px);
    gap: 1.5rem;
    align-items: start;
}

.contact-view-main,
.contact-view-side {
    min-width: 0;
}

.section-card {
    background: #ffffff;
    border: 1px solid #e7edf2;
    border-radius: 1.4rem;
    padding: 1.6rem;
    margin-bottom: 1.4rem;
}

.section-card:last-child {
    margin-bottom: 0;
}

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid #eef2f5;
}

.section-card-header h3 {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    color: #2f3943;
    letter-spacing: -0.02em;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 1rem;
}

.detail-grid-contact {
    margin-bottom: 0;
}

.info-box {
    background: #f8fbfd;
    border: 1px solid #e6edf2;
    border-radius: 1.2rem;
    padding: 1.15rem 1.2rem;
    min-height: 100%;
}

.info-box .label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: #7a8793;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.info-box .value {
    color: #25313c;
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.message-panel {
    background: #fbfcfe;
    border: 1px solid #e8edf3;
    border-left: 4px solid var(--sc-green);
    border-radius: 1.2rem;
    padding: 1.35rem 1.4rem;
    color: #33414d;
    font-size: 1.6rem;
    line-height: 1.75;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.message-panel p {
    margin: 0 0 1rem;
}

.message-panel p:last-child {
    margin-bottom: 0;
}

.account-restriction-card {
    max-width: 820px;
}

.restriction-form textarea {
    min-height: 14rem;
}

.user-restriction-reason {
    margin-top: 1.2rem;
}

.user-restriction-reason p {
    margin: 0.7rem 0 0;
}

.side-summary-card {
    position: sticky;
    top: 2rem;
}

.summary-stack {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.summary-item {
    padding-bottom: 1rem;
    border-bottom: 1px solid #eef2f5;
}

.summary-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.summary-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: #7a8793;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.summary-value {
    color: #2f3943;
    font-size: 1.45rem;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.summary-empty {
    color: #8a97a3;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    margin: 0 0.45rem 0.45rem 0;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: #eef6f1;
    color: var(--sc-green);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
    font-size: 1.5rem;
    text-decoration: none;
    color: #5a6773;
}

.back-link:hover {
    color: var(--sc-green);
    text-decoration: none;
}

.showcase-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: space-evenly;
}

.showcase-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.showcase-options {
    display: grid;
    grid-template-columns: repeat(3, 220px);
    gap: 20px;
    justify-content: space-evenly;
}

.showcase-checkbox {
    display: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.showcase-label {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 1100px) {
    .contact-view-grid {
        grid-template-columns: 1fr;
    }

    .side-summary-card {
        position: static;
    }
}

@media (max-width: 900px) {
    .page-header {
        align-items: stretch;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .button,
    .page-actions a.button {
        flex: 1 1 180px;
        text-align: center;
    }

    .filter-card .row {
        gap: 0;
    }

    .data-card {
        padding: 0.8rem;
    }

    .contact-forms-table {
        min-width: 1000px;
    }

    .promotion-edit-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-title {
        font-size: 2.6rem;
    }
}

@media (max-width: 640px) {
    .page-header h3,
    .page-header h1 {
        font-size: 2rem;
    }

    .page-header p {
        font-size: 1.35rem;
    }

    .filter-card {
        padding: 1.2rem;
    }

    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-actions .button,
    .filter-actions button,
    .filter-actions input[type="submit"],
    .filter-actions input[type="reset"] {
        width: 100%;
        min-width: 0;
    }

    td.actions a,
    td.actions .postlink-delete {
        width: 100%;
        margin: 0.25rem 0;
    }

    .detail-card,
    .detail-card-contact-form {
        padding: 1.4rem;
    }

    .section-card {
        padding: 1.2rem;
    }

    .detail-title {
        font-size: 2.2rem;
    }
}
