/**
 * AtHealth CRM — GFE Tools frontend styles
 * Applies to: WooCommerce My Account > GFE Tools endpoint.
 */

/* ── Page wrapper ──────────────────────────────────────────────────────── */

.acrm-gfe-wrap h2 {
    margin-top: 0;
}

.acrm-gfe-intro {
    color: #555;
    margin-bottom: 20px;
}

.acrm-gfe-last-generated {
    background: #f0f6fc;
    border-left: 3px solid #4a9eda;
    color: #444;
    font-size: 0.875em;
    margin-bottom: 16px;
    padding: 8px 12px;
}

/* ── Section cards ─────────────────────────────────────────────────────── */

.acrm-gfe-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-bottom: 24px;
    padding: 18px 20px 20px;
}

.acrm-gfe-section h3 {
    border-bottom: 1px solid #eee;
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 14px;
    padding-bottom: 10px;
}

/* ── Field rows ────────────────────────────────────────────────────────── */

.acrm-gfe-field-row {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.acrm-gfe-field-row label {
    color: #333;
    flex: 0 0 160px;
    font-weight: 600;
    line-height: 36px;
}

.acrm-gfe-field-row input[type="text"],
.acrm-gfe-field-row input[type="email"],
.acrm-gfe-field-row input[type="tel"],
.acrm-gfe-field-row input[type="number"],
.acrm-gfe-field-row textarea {
    border: 1px solid #ccc;
    border-radius: 3px;
    flex: 1 1 260px;
    font-size: 0.95em;
    padding: 7px 10px;
}

.acrm-gfe-field-row textarea {
    line-height: 1.5;
    resize: vertical;
}

.acrm-gfe-field-row--full {
    flex-direction: column;
}

.acrm-gfe-field-row--full label {
    flex: none;
    line-height: 1.4;
    margin-bottom: 4px;
}

.acrm-gfe-field-row--full textarea {
    flex: none;
    width: 100%;
}

.acrm-gfe-short {
    flex: 0 0 90px !important;
    max-width: 90px;
}

.acrm-gfe-unit {
    color: #666;
    font-size: 0.875em;
    line-height: 36px;
}

/* ── Logo upload ───────────────────────────────────────────────────────── */

.acrm-gfe-logo-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#acrm-gfe-logo-preview {
    border: 1px solid #ddd;
    border-radius: 3px;
    display: block;
    max-height: 70px;
    object-fit: contain;
    padding: 4px;
}

/* ── Address block ─────────────────────────────────────────────────────── */

.acrm-gfe-address-block {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
}

.acrm-gfe-address-block input {
    border: 1px solid #ccc;
    border-radius: 3px;
    flex: 1 1 200px;
    font-size: 0.95em;
    padding: 7px 10px;
}

.acrm-gfe-copy-btn {
    align-self: flex-start;
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    color: #444 !important;
    font-size: 0.85em !important;
    padding: 5px 10px !important;
    white-space: nowrap;
}

.acrm-gfe-copy-btn:hover {
    background: #eaeaea !important;
    color: #222 !important;
}

/* ── Dynamic tables ────────────────────────────────────────────────────── */

.acrm-gfe-table {
    border-collapse: collapse;
    margin-bottom: 10px;
    width: 100%;
}

.acrm-gfe-table th {
    background: #f9f9f9;
    border-bottom: 2px solid #e0e0e0;
    color: #555;
    font-size: 0.8em;
    font-weight: 600;
    padding: 7px 8px;
    text-align: left;
    text-transform: uppercase;
}

.acrm-gfe-table td {
    border-bottom: 1px solid #eee;
    padding: 5px 6px;
    vertical-align: middle;
}

.acrm-gfe-table input {
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 0.9em;
    padding: 5px 7px;
    width: 100%;
}

.acrm-gfe-code {
    width: 100px !important;
}

.acrm-gfe-fee {
    width: 80px !important;
}

.acrm-gfe-remove-row {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: #a00 !important;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    padding: 2px 6px !important;
}

.acrm-gfe-remove-row:hover {
    background: none !important;
    color: #d00 !important;
}

/* ── Hint text ─────────────────────────────────────────────────────────── */

.acrm-gfe-hint {
    color: #777;
    font-size: 0.825em;
    margin: 2px 0 0;
}

/* ── Actions bar ───────────────────────────────────────────────────────── */

.acrm-gfe-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 8px;
}

.acrm-gfe-generate-btn {
    background: #2e7d32 !important;
    border-color: #2e7d32 !important;
    color: #fff !important;
    font-weight: 600;
    text-decoration: none;
}

.acrm-gfe-generate-btn:hover {
    background: #256428 !important;
    border-color: #256428 !important;
    color: #fff !important;
}

.acrm-gfe-result,
.acrm-gfe-save-result {
    font-size: 0.9em;
    font-weight: 600;
}

.acrm-gfe-success {
    color: #2e7d32;
}

.acrm-gfe-error {
    color: #c62828;
}

/* ── Clinical Forms Library ────────────────────────────────────────────── */

.acrm-cf-wrap h2 {
    margin-top: 0;
}

.acrm-cf-intro {
    color: #555;
    margin-bottom: 12px;
}

.acrm-cf-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat( 2, 1fr );
    margin-top: 24px;
}

@media ( max-width: 600px ) {
    .acrm-cf-grid {
        grid-template-columns: 1fr;
    }
}

.acrm-cf-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
}

.acrm-cf-card__body {
    flex: 1 1 auto;
    padding: 16px 18px 12px;
}

.acrm-cf-card__title {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 8px;
}

.acrm-cf-card__desc {
    color: #666;
    font-size: 0.875em;
    line-height: 1.5;
    margin: 0;
}

.acrm-cf-card__footer {
    border-top: 1px solid #eee;
    padding: 12px 18px;
}

.acrm-cf-download-btn {
    width: 100%;
    text-align: center;
}

/* ── Practice Tools page ─────────────────────────────────────────────────── */

.acrm-practice-tools > h2 {
    color: #1E1A3A;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

/* ── Tab navigation ──────────────────────────────────────────────────────── */

.acrm-pt-tabs {
    border-bottom: 2px solid #e0dff0;
    display: flex;
    gap: 0;
    margin-bottom: 24px;
}

.acrm-pt-tab {
    background: none !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #64748b !important;
    cursor: pointer;
    font-size: .92rem;
    font-weight: 600;
    margin-bottom: -2px;
    padding: 10px 18px !important;
    transition: color .15s;
    white-space: nowrap;
}

.acrm-pt-tab:hover {
    background: none !important;
    color: #6B63AD !important;
}

.acrm-pt-tab--active {
    border-bottom-color: #6B63AD !important;
    color: #1E1A3A !important;
}

.acrm-pt-tab__hint {
    color: #d97706;
    font-size: .85em;
    margin-left: 4px;
}

/* ── Panel display ───────────────────────────────────────────────────────── */

.acrm-pt-panel--hidden {
    display: none !important;
}

/* ── Profile completion banner ───────────────────────────────────────────── */

.acrm-pt-completion-banner {
    border-radius: 6px;
    margin-bottom: 20px;
    padding: 12px 16px;
}

.acrm-pt-completion-banner--incomplete {
    background: #fffbeb;
    border: 1px solid #fcd34d;
}

.acrm-pt-completion-banner--complete {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.acrm-pt-completion-banner__row {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    justify-content: space-between;
    margin-bottom: 8px;
}

.acrm-pt-completion-banner__text {
    font-size: .875rem;
    font-weight: 600;
}

.acrm-pt-completion-banner__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.acrm-pt-req-chip {
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 8px;
}

.acrm-pt-req-chip--ok {
    background: #dcfce7;
    color: #15803d;
}

.acrm-pt-req-chip--missing {
    background: #fef3c7;
    color: #92400e;
}

.acrm-pt-completion-bar-wrap {
    background: #e5e7eb;
    border-radius: 4px;
    height: 4px;
    overflow: hidden;
}

.acrm-pt-completion-banner--complete .acrm-pt-completion-bar-wrap {
    background: #bbf7d0;
}

.acrm-pt-completion-bar {
    background: #6B63AD;
    border-radius: 4px;
    height: 100%;
    transition: width .3s ease;
}

.acrm-pt-completion-banner--complete .acrm-pt-completion-bar {
    background: #22c55e;
}

/* Required star + optional label */

.acrm-pt-req-star {
    color: #6B63AD;
    font-size: .8em;
}

.acrm-gfe-optional-label {
    color: #999;
    font-size: .8em;
    font-weight: 400;
}

/* ── Amber warning box (GFE panel) ───────────────────────────────────────── */

.acrm-pt-amber-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    color: #78350f;
    font-size: .875rem;
    margin-bottom: 20px;
    padding: 12px 16px;
}

.acrm-pt-amber-warning:empty {
    display: none;
}

.acrm-pt-amber-warning a {
    color: #92400e;
    font-weight: 600;
    margin-left: 4px;
    text-decoration: underline;
}

/* ── ICD-10 group accordions ─────────────────────────────────────────────── */

.acrm-pt-icd-section > h3 {
    margin-bottom: 6px;
}

.acrm-pt-icd-section > .acrm-gfe-hint {
    margin-bottom: 14px;
}

.acrm-pt-icd-group {
    border: 1px solid #e8e6f5;
    border-radius: 4px;
    margin-bottom: 6px;
    overflow: hidden;
}

.acrm-pt-icd-group__summary {
    align-items: center;
    background: #f8f7fc;
    cursor: pointer;
    display: flex;
    font-size: .9rem;
    font-weight: 600;
    gap: 8px;
    list-style: none;
    padding: 10px 14px;
    user-select: none;
}

.acrm-pt-icd-group__summary::-webkit-details-marker {
    display: none;
}

.acrm-pt-icd-group__summary::after {
    content: '▼';
    font-size: .6em;
    color: #999;
    margin-left: auto;
    transition: transform .2s;
}

.acrm-pt-icd-group[open] > .acrm-pt-icd-group__summary::after {
    transform: rotate( 180deg );
}

.acrm-pt-icd-group__count {
    background: #ede9fe;
    border-radius: 20px;
    color: #6B63AD;
    font-size: .7rem;
    font-weight: 600;
    padding: 2px 8px;
}

.acrm-pt-icd-group__body {
    border-top: 1px solid #e8e6f5;
    padding: 10px 14px 12px;
}

.acrm-pt-icd-group__body .acrm-gfe-table {
    margin-bottom: 8px;
}

/* ── GFE Generator footer bar ────────────────────────────────────────────── */

.acrm-pt-gfe-footer {
    align-items: center;
    background: #f8f7fc;
    border: 1px solid #e0dff0;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: space-between;
    margin-top: 8px;
    padding: 14px 18px;
}

.acrm-pt-gfe-footer__left,
.acrm-pt-gfe-footer__right {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
}

.acrm-pt-generate-hint {
    color: #92400e;
    font-size: .8rem;
}

.acrm-gfe-generate-btn--disabled {
    cursor: not-allowed !important;
    opacity: .45 !important;
    pointer-events: none !important;
}

/* ── Clinical Forms — profile info banner ────────────────────────────────── */

.acrm-pt-cf-info-banner {
    border-radius: 6px;
    font-size: .875rem;
    margin-bottom: 16px;
    padding: 10px 14px;
}

.acrm-pt-cf-info-banner--ok {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.acrm-pt-cf-info-banner--warn {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #78350f;
}

.acrm-pt-cf-info-banner a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* ── Clinical Forms — field status chips ─────────────────────────────────── */

.acrm-cf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
}

.acrm-cf-chip {
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 600;
    padding: 2px 8px;
}

.acrm-cf-chip--ok {
    background: #dcfce7;
    color: #15803d;
}

.acrm-cf-chip--warn {
    background: #fef3c7;
    color: #92400e;
}

/* ── Tab-link (tab-switching anchor) ─────────────────────────────────────── */

.acrm-pt-tab-link {
    cursor: pointer;
    text-decoration: underline;
}

/* ── Access gate for non-enrolled users ─────────────────────────────────── */

.acrm-pt-access-gate {
    background: #f8f7fc;
    border: 1px solid #e0dff0;
    border-radius: 10px;
    margin: 40px auto;
    max-width: 480px;
    padding: 40px 32px;
    text-align: center;
}

.acrm-pt-access-gate__icon {
    color: #6B63AD;
    margin-bottom: 16px;
}

.acrm-pt-access-gate h3 {
    color: #1E1A3A;
    font-size: 1.1rem;
    margin: 0 0 10px;
}

.acrm-pt-access-gate p {
    color: #64748b;
    font-size: .9rem;
    margin: 0 0 20px;
}

/* ── Astra/WooCommerce button overrides ──────────────────────────────────── */

.acrm-gfe-add-row {
    background: #fff !important;
    border: 1px solid #6B63AD !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    color: #6B63AD !important;
    cursor: pointer;
    font-size: 0.875em !important;
    font-weight: 500 !important;
    padding: 5px 12px !important;
}

.acrm-gfe-add-row:hover {
    background: #6B63AD !important;
    color: #fff !important;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media ( max-width: 600px ) {
    .acrm-pt-access-gate {
        padding: 28px 20px;
    }

    .acrm-pt-tabs {
        overflow-x: auto;
    }

    .acrm-pt-gfe-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .acrm-pt-gfe-footer__right {
        flex-direction: column;
    }
}
