/* ==========================================================================
   AdvisorX Admin Apps – Shared Stylesheet
   Covers: Smart Route Messages (.advisorx-srm-*) and
           Prospecting Advisors  (.advisorx-pa-*)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Shared status helpers (used by both apps)
   -------------------------------------------------------------------------- */

.advisorx-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.advisorx-shell-nav {
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 12px;
    padding: 12px;
    background: linear-gradient(125deg, rgba(243, 247, 255, 0.85), rgba(244, 252, 246, 0.85));
}

.advisorx-shell-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.advisorx-shell-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.advisorx-shell-tab {
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 999px;
    background: #fff;
    color: #111;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.advisorx-shell-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.advisorx-shell-tab.is-active {
    border-color: #0b63ce;
    background: #0b63ce;
    color: #fff;
}

.advisorx-shell-description {
    margin: 10px 0 0;
    color: rgba(0, 0, 0, 0.72);
}

.advisorx-shell-screen-inner {
    min-height: 150px;
}

.advisorx-srm-status,
.advisorx-pa-status {
    min-height: 20px;
    margin-bottom: 12px;
}

.advisorx-srm-status.is-error,
.advisorx-pa-status.is-error {
    color: #b42318;
}

.advisorx-srm-status.is-ok,
.advisorx-pa-status.is-ok {
    color: #067647;
}

/* StatusMessage shared component */
.advisorx-status-msg {
    min-height: 20px;
    margin-bottom: 12px;
}

.advisorx-status-msg--ok {
    color: #067647;
}

.advisorx-status-msg--error {
    color: #b42318;
}

/* LoadingSpinner shared component */
.advisorx-spinner {
    display: inline-block;
    animation: advisorx-spin 1s linear infinite;
    font-style: normal;
}

@keyframes advisorx-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Smart Route Messages
   ========================================================================== */

.advisorx-srm-wrap {
    max-width: 1100px;
}

.advisorx-srm-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.advisorx-srm-view-builder {
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, rgba(240, 247, 255, 0.8), rgba(245, 255, 245, 0.75));
}

.advisorx-srm-view-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.advisorx-srm-view-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.advisorx-srm-groupby-btn {
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 999px;
    background: #fff;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.advisorx-srm-groupby-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.advisorx-srm-groupby-btn.is-active {
    border-color: #0b63ce;
    background: #0b63ce;
    color: #fff;
}

.advisorx-srm-view-subtext {
    margin: 0;
    color: rgba(0, 0, 0, 0.7);
}

.advisorx-srm-shop {
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: #fff;
}

.advisorx-srm-shop-head {
    font-weight: 700;
    margin-bottom: 12px;
}

.advisorx-srm-groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.advisorx-srm-group {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 12px;
    border-radius: 10px;
    background: rgba(250, 251, 255, 0.72);
}

.advisorx-srm-group-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.advisorx-srm-group h3 {
    margin: 0;
    font-size: 1rem;
}

.advisorx-srm-group-subtext {
    margin: 0;
    color: rgba(0, 0, 0, 0.7);
}

.advisorx-srm-badge {
    font-size: 0.78rem;
    border-radius: 999px;
    background: rgba(11, 99, 206, 0.1);
    color: #0b63ce;
    padding: 4px 8px;
    white-space: nowrap;
}

.advisorx-srm-subgroups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.advisorx-srm-subgroup {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.advisorx-srm-subgroup h4 {
    margin: 0 0 8px;
    font-size: 0.92rem;
}

.advisorx-srm-field {
    margin-bottom: 10px;
}

.advisorx-srm-field:last-child {
    margin-bottom: 0;
}

.advisorx-srm-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.advisorx-srm-field small {
    display: block;
    margin-bottom: 4px;
    color: rgba(0, 0, 0, 0.72);
}

.advisorx-srm-input,
.advisorx-srm-textarea {
    width: 100%;
}

.advisorx-srm-textarea {
    min-height: 72px;
    resize: vertical;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    padding: 6px 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

/* Tabs */
.advisorx-srm-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.12);
    margin-bottom: 16px;
}

.advisorx-srm-tab {
    padding: 8px 18px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.advisorx-srm-tab:hover {
    color: #0b63ce;
}

.advisorx-srm-tab.is-active {
    color: #0b63ce;
    border-bottom-color: #0b63ce;
    font-weight: 600;
}

/* Panel description */
.advisorx-srm-panel-desc {
    color: rgba(0, 0, 0, 0.7);
    margin-bottom: 14px;
}

/* Field-level inherited / custom states */
.advisorx-srm-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.advisorx-srm-field--inherited {
    background: rgba(245, 246, 248, 0.9);
    border-radius: 6px;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    margin-bottom: 10px;
}

.advisorx-srm-field--inherited:last-child {
    margin-bottom: 0;
}

.advisorx-srm-field--custom {
    background: rgba(240, 249, 255, 0.85);
    border-radius: 6px;
    padding: 8px;
    border: 1px solid #0b63ce;
    box-shadow: 0 0 0 1px rgba(11, 99, 206, 0.15);
    margin-bottom: 10px;
}

.advisorx-srm-field--custom:last-child {
    margin-bottom: 0;
}

/* Inherited / Custom state badges */
.advisorx-srm-badge-inherited {
    font-size: 0.72rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.5);
    padding: 2px 8px;
    white-space: nowrap;
}

.advisorx-srm-badge-custom {
    font-size: 0.72rem;
    border-radius: 999px;
    background: rgba(11, 99, 206, 0.12);
    color: #0b63ce;
    padding: 2px 8px;
    white-space: nowrap;
    font-weight: 600;
}

/* Textarea states */
.advisorx-srm-textarea--inherited {
    color: rgba(0, 0, 0, 0.45);
    background: rgba(0, 0, 0, 0.025);
    font-style: italic;
}

.advisorx-srm-textarea--custom {
    border-color: #0b63ce;
    color: #000;
    background: #fff;
}

/* Reset-to-global button */
.advisorx-srm-reset-btn {
    margin-top: 6px;
    font-size: 0.78rem;
    padding: 3px 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.65);
    transition: background 0.15s, color 0.15s;
}

.advisorx-srm-reset-btn:hover {
    background: #b42318;
    color: #fff;
    border-color: #b42318;
}

/* ==========================================================================
   Prospecting Advisors
   ========================================================================== */

.advisorx-pa-wrap {
    max-width: 980px;
}

.advisorx-pa-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.advisorx-pa-shop {
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
}

.advisorx-pa-shop-head {
    font-weight: 600;
    margin-bottom: 10px;
}

.advisorx-pa-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.advisorx-pa-list {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 10px;
}

.advisorx-pa-list h3 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.advisorx-pa-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.advisorx-pa-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
    align-items: center;
}

.advisorx-pa-prefix {
    padding: 6px 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    user-select: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.advisorx-pa-phone {
    width: 100%;
}

.advisorx-pa-phone.is-invalid {
    border-color: #b42318;
    outline-color: #b42318;
}

@media (max-width: 760px) {
    .advisorx-pa-lists {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Automated Messaging (.advisorx-am-*)
   ========================================================================== */

.advisorx-am-wrap {
    max-width: 900px;
}

.advisorx-am-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.advisorx-am-status {
    min-height: 20px;
    margin-bottom: 12px;
}

.advisorx-am-status.is-error { color: #b42318; }
.advisorx-am-status.is-ok    { color: #067647; }

/* Tabs */
.advisorx-am-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.12);
    margin-bottom: 16px;
}

.advisorx-am-tab {
    padding: 8px 18px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.advisorx-am-tab:hover {
    color: #0b63ce;
}

.advisorx-am-tab.is-active {
    color: #0b63ce;
    border-bottom-color: #0b63ce;
    font-weight: 600;
}

/* Panel */
.advisorx-am-panel {
    /* intentionally transparent wrapper */
}

.advisorx-am-panel-desc {
    color: rgba(0, 0, 0, 0.7);
    margin-bottom: 14px;
}

/* Shop card */
.advisorx-am-shop {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
    background: #fff;
}

.advisorx-am-shop-head {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 12px;
}

/* Section within a shop or global panel */
.advisorx-am-section {
    margin-bottom: 14px;
}

.advisorx-am-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Fields grid */
.advisorx-am-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

/* Individual field */
.advisorx-am-field {
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fafbff;
    transition: border-color 0.15s, background 0.15s;
}

/* Inherited state: subtle, greyed */
.advisorx-am-field--inherited {
    background: rgba(245, 246, 248, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
}

/* Custom override state: highlighted */
.advisorx-am-field--custom {
    background: rgba(240, 249, 255, 0.85);
    border-color: #0b63ce;
    box-shadow: 0 0 0 1px rgba(11, 99, 206, 0.15);
}

.advisorx-am-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.advisorx-am-field label {
    font-weight: 600;
    display: block;
}

.advisorx-am-field small {
    display: block;
    margin-bottom: 6px;
    color: rgba(0, 0, 0, 0.65);
}

/* Status badges */
.advisorx-am-badge-inherited {
    font-size: 0.72rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.55);
    padding: 2px 8px;
    white-space: nowrap;
}

.advisorx-am-badge-custom {
    font-size: 0.72rem;
    border-radius: 999px;
    background: rgba(11, 99, 206, 0.12);
    color: #0b63ce;
    padding: 2px 8px;
    white-space: nowrap;
    font-weight: 600;
}

/* Textarea */
.advisorx-am-textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    padding: 6px 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.advisorx-am-textarea--inherited {
    color: rgba(0, 0, 0, 0.45);
    background: rgba(0, 0, 0, 0.025);
    font-style: italic;
}

.advisorx-am-textarea--custom {
    border-color: #0b63ce;
    color: #000;
    background: #fff;
}

/* Reset button */
.advisorx-am-reset-btn {
    margin-top: 6px;
    font-size: 0.78rem;
    padding: 3px 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.65);
    transition: background 0.15s, color 0.15s;
}

.advisorx-am-reset-btn:hover {
    background: #b42318;
    color: #fff;
    border-color: #b42318;
}

@media (max-width: 600px) {
    .advisorx-am-fields {
        grid-template-columns: 1fr;
    }
}
