/* Testimonials section, "share your review" strip and review form dialog */
.tm-section,
.tm-band-section,
.tm-dialog {
    --tm-teal: #0f766e;
    --tm-teal-hover: #0b5f58;
    --tm-teal-soft: #e6f5f3;
    --tm-ink: #0d253f;
    --tm-muted: #4b6070;
    --tm-card: #ffffff;
    --tm-line: rgba(15, 118, 110, 0.16);
    --tm-field: #f7fbfb;
    --tm-star: #f59e0b;
    --tm-star-off: #d5dde3;
}

[data-theme="dark"] .tm-section,
[data-theme="dark"] .tm-band-section,
[data-theme="dark"] .tm-dialog {
    --tm-teal: #2dd4bf;
    --tm-teal-soft: rgba(45, 212, 191, 0.12);
    --tm-ink: #f1f5f9;
    --tm-muted: #a5b4c3;
    --tm-card: #132f4c;
    --tm-line: rgba(148, 163, 184, 0.2);
    --tm-field: #0f2740;
    --tm-star-off: #3b5068;
}

/* ---------- Section with review cards ---------- */
.tm-section {
    padding: 80px 0;
    color: var(--tm-ink);
}

.tm-container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.tm-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    margin-bottom: 40px;
}

.tm-badge {
    display: inline-flex;
    background: var(--tm-teal-soft);
    color: var(--tm-teal);
    font-size: 15px;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 999px;
}

.tm-title {
    margin: 0;
    font-size: clamp(26px, 3.4vw, 40px);
    font-weight: 800;
    line-height: 1.35;
    color: var(--tm-ink);
}

.tm-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.tm-card {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px;
    border-radius: 20px;
    background: var(--tm-card);
    border: 1px solid var(--tm-line);
}

.tm-card-stars {
    display: flex;
    gap: 4px;
    color: var(--tm-star);
    font-size: 15px;
}

.tm-card-stars .far {
    color: var(--tm-star-off);
}

.tm-card-text {
    margin: 0;
    font-size: 16px;
    line-height: 1.8;
    color: var(--tm-ink);
    flex-grow: 1;
}

.tm-card-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--tm-teal);
}

.tm-cta {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

/* ---------- Compact strip (fewer than 3 published reviews) ---------- */
.tm-band-section {
    padding: 40px 20px;
}

.tm-band {
    max-width: 1100px;
    margin: 0 auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 32px;
    border-radius: 20px;
    background: var(--tm-card);
    border: 1px solid var(--tm-line);
}

.tm-band-text h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 800;
    color: var(--tm-ink);
}

.tm-band-text p {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: var(--tm-muted);
}

/* ---------- Buttons ---------- */
.tm-open-btn,
.tm-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 26px;
    border: none;
    border-radius: 12px;
    background: #0f766e;
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}

.tm-open-btn:hover,
.tm-submit:hover {
    background: #0b5f58;
}

.tm-submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

.tm-open-btn:focus-visible,
.tm-submit:focus-visible,
.tm-close:focus-visible {
    outline: 3px solid #2dd4bf;
    outline-offset: 2px;
}

/* ---------- Dialog ---------- */
.tm-dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border: none;
    border-radius: 20px;
    background: var(--tm-card);
    color: var(--tm-ink);
    box-shadow: 0 24px 60px rgba(13, 37, 63, 0.25);
    overflow: auto;
}

.tm-dialog::backdrop {
    background: rgba(13, 37, 63, 0.55);
}

.tm-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 28px;
    text-align: start;
}

.tm-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tm-dialog-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--tm-ink);
}

.tm-close {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 1px solid var(--tm-line);
    border-radius: 12px;
    background: transparent;
    color: var(--tm-ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.tm-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: none;
    position: relative;
}

.tm-field label,
.tm-field legend {
    padding: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--tm-ink);
}

.tm-field input,
.tm-field textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--tm-line);
    background: var(--tm-field);
    color: var(--tm-ink);
    font-family: inherit;
    font-size: 15px;
}

.tm-field textarea {
    resize: vertical;
    min-height: 120px;
}

.tm-field input::placeholder,
.tm-field textarea::placeholder {
    color: #7b8d9b;
}

.tm-field input:focus,
.tm-field textarea:focus {
    outline: none;
    border-color: var(--tm-teal);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.tm-counter {
    align-self: flex-end;
    font-size: 12px;
    color: var(--tm-muted);
}

/* Star rating: DOM order is 5..1; row-reverse puts 1 at the reading start in both directions */
.tm-stars-input {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 6px;
}

.tm-stars-input input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.tm-stars-input label {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 26px;
    color: var(--tm-star-off);
    cursor: pointer;
    transition: color 0.12s ease;
}

.tm-stars-input input:checked + label,
.tm-stars-input input:checked + label ~ label,
.tm-stars-input label:hover,
.tm-stars-input label:hover ~ label {
    color: var(--tm-star);
}

.tm-stars-input input:focus-visible + label {
    outline: 3px solid #2dd4bf;
    outline-offset: 2px;
}

.tm-sr,
.tm-hp {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.tm-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--tm-ink);
    cursor: pointer;
}

.tm-consent input {
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: #0f766e;
}

.tm-note {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--tm-muted);
}

.tm-status {
    min-height: 20px;
    font-size: 14px;
    text-align: center;
    color: var(--tm-muted);
}

.tm-status.success {
    color: #0f766e;
}

.tm-status.error {
    color: #b42318;
}

[data-theme="dark"] .tm-status.success {
    color: #2dd4bf;
}

[data-theme="dark"] .tm-status.error {
    color: #fca5a5;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .tm-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .tm-section {
        padding: 48px 0;
    }

    .tm-container {
        padding: 0 16px;
    }

    .tm-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .tm-card {
        padding: 22px;
    }

    .tm-band-section {
        padding: 32px 16px;
    }

    .tm-band {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 24px 20px;
    }

    .tm-form {
        padding: 22px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tm-open-btn,
    .tm-submit,
    .tm-stars-input label {
        transition: none;
    }
}

/* A global reset removes the dialog's default centering; restore it */
.tm-dialog[open] {
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
}
