/* ==========================================================================
   ToanWeb Phong Thủy — Shortcode Frontend Styles
   Prefix: .twpt-sc-  /  .twpt-modal
   ========================================================================== */

/* --------------------------------------------------------------------------
   Form Wrap
   -------------------------------------------------------------------------- */
.twpt-sc-wrap {
   font-family: inherit;
    font-size: 15px;
    color: #1F2937;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
    padding: 32px 28px 28px;
    max-width: 480px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Title
   -------------------------------------------------------------------------- */
.twpt-sc-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #0783BE !important;
    text-align: center;
    margin: 0 0 28px !important;
    padding: 0 !important;
    line-height: 1.3 !important;
    letter-spacing: -.3px;
}

/* --------------------------------------------------------------------------
   Field
   -------------------------------------------------------------------------- */
.twpt-sc-field {
    margin-bottom: 18px;
}

.twpt-sc-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 7px;
}

.twpt-sc-input {
    display: block;
    width: 100%;
    padding: 11px 14px;
    font-size: 15px;
    font-family: inherit;
    color: #1F2937;
    background: #fff;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    height: auto;
}

.twpt-sc-input:focus {
    border-color: #0783BE;
    box-shadow: 0 0 0 3px rgba(7, 131, 190, .15);
}

.twpt-sc-input.twpt-sc-input--error {
    border-color: #C0392B;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, .12);
}

/* Select arrow */
.twpt-sc-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   Error message
   -------------------------------------------------------------------------- */
.twpt-sc-error {
    padding: 10px 14px;
    background: #FDECEA;
    border: 1px solid #E87A70;
    border-radius: 8px;
    color: #C0392B;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Button
   -------------------------------------------------------------------------- */
.twpt-sc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity .15s, transform .15s, box-shadow .15s;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    position: relative;
    line-height: 1;
}

.twpt-sc-btn:hover:not(:disabled) {
    opacity: .92;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,.20);
}

.twpt-sc-btn:active:not(:disabled) {
    transform: translateY(0);
    opacity: .85;
}

.twpt-sc-btn:disabled {
    opacity: .7;
    cursor: not-allowed;
}

/* Spinner inside button */
.twpt-sc-btn__spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: twpt-sc-spin .7s linear infinite;
    opacity: .8;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Standalone spinner
   -------------------------------------------------------------------------- */
.twpt-sc-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #E5E7EB;
    border-top-color: #0783BE;
    border-radius: 50%;
    animation: twpt-sc-spin .8s linear infinite;
}

/* --------------------------------------------------------------------------
   Modal Overlay
   -------------------------------------------------------------------------- */
.twpt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}

.twpt-modal-overlay.twpt-modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

/* --------------------------------------------------------------------------
   Modal Card
   -------------------------------------------------------------------------- */
.twpt-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.12);
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(16px) scale(.97);
    transition: transform .2s cubic-bezier(.34,1.56,.64,1);
   font-family: inherit;
    overflow: hidden;
}

.twpt-modal-overlay--open .twpt-modal {
    transform: translateY(0) scale(1);
}

/* Modal Header */
.twpt-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.twpt-modal__title {
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #1F2937 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
}

.twpt-modal__close {
    width: 32px;
    height: 32px;
    border: none;
    background: #F3F4F6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    flex-shrink: 0;
    transition: background .15s, color .15s;
    padding: 0;
}

.twpt-modal__close:hover {
    background: #E5E7EB;
    color: #1F2937;
}

/* Modal Body */
.twpt-modal__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Loading state */
.twpt-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 32px 0;
    color: #9CA3AF;
    font-size: 14px;
}

/* Error state */
.twpt-modal__error {
    padding: 16px 18px;
    background: #FDECEA;
    border: 1px solid #E87A70;
    border-radius: 10px;
    color: #C0392B;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Result: JSON object → bảng key/value
   -------------------------------------------------------------------------- */
.twpt-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.twpt-result-table tr:not(:last-child) {
    border-bottom: 1px solid #F3F4F6;
}

.twpt-result-table td:first-child {
    padding: 10px 14px 10px 0;
    color: #6B7280;
    font-weight: 500;
    white-space: nowrap;
    width: 40%;
    vertical-align: top;
}

.twpt-result-table td:last-child {
    padding: 10px 0;
    color: #1F2937;
    font-weight: 600;
    vertical-align: top;
}

/* Result: raw text */
.twpt-result-raw {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   HTML result (rich text from API)
   -------------------------------------------------------------------------- */
.twpt-result-html {
    font-size: 1rem;
    color: #374151;
    line-height: 1.8;
    font-weight: normal;
    .boldLabel { font-weight: 600; color: #111827; }
}
.twpt-result-html h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0783BE;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #E8F4FB;
    line-height: 1.4;
}
.twpt-result-html h2, .twpt-result-html h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1F2937;
    margin: 16px 0 8px;
}
.twpt-result-html p {
    margin: 0 0 10px;
}
.twpt-result-html ul, .twpt-result-html ol {
    margin: 0 0 10px;
    padding-left: 22px;
}
.twpt-result-html li {
    margin-bottom: 4px;
}
.twpt-result-html b, .twpt-result-html strong {
    color: #111827;
}
.twpt-result-html i { font-style: italic; }
.twpt-result-html .color_green { color: #2E7D52; }
.twpt-result-html hr {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 16px 0;
}
.twpt-result-html div > p:last-child,
.twpt-result-html > p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes twpt-sc-spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
    .twpt-sc-wrap { padding: 24px 18px 20px; }
    .twpt-modal   { border-radius: 14px; }
    .twpt-modal__body { padding: 18px; }
}
