/**
 * Trill Chat Lite — Admin Styles
 *
 * @package TrillChatLite
 * @since 1.0.0
 * @license GPL-2.0-or-later
 */

/* ========================================
   Dashboard
   ======================================== */

.trcl-dashboard-wrap {
    max-width: 800px;
}

.trcl-dashboard-wrap h1 {
    font-size: 23px;
    font-weight: 400;
    margin: 0;
    padding: 9px 0 4px;
    line-height: 1.3;
}

/* Status Card */
.trcl-status-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 24px;
    margin: 20px 0;
}

.trcl-status-card h2 {
    margin-top: 0;
    font-size: 18px;
}

.trcl-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f1;
}

.trcl-status-row:last-child {
    border-bottom: none;
}

.trcl-status-label {
    font-weight: 600;
    color: #1d2327;
}

.trcl-status-value {
    color: #50575e;
}

.trcl-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.trcl-status-badge--active {
    background: #d1fae5;
    color: #065f46;
}

.trcl-status-badge--inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Usage Bar */
.trcl-usage-bar-container {
    margin: 16px 0;
}

.trcl-usage-bar {
    background: #f0f0f1;
    border-radius: 4px;
    height: 24px;
    overflow: hidden;
    position: relative;
}

.trcl-usage-bar-fill {
    background: #10b981;
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 2px;
}

.trcl-usage-bar-fill--warning {
    background: #f59e0b;
}

.trcl-usage-bar-fill--danger {
    background: #ef4444;
}

.trcl-usage-text {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 13px;
    color: #50575e;
}

/* ========================================
   Settings
   ======================================== */

.trcl-settings-wrap {
    max-width: 800px;
}

.trcl-settings-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 24px;
    margin: 20px 0;
}

.trcl-settings-section h2 {
    margin-top: 0;
    padding-top: 0;
    font-size: 16px;
}

.trcl-form-table td {
    padding: 15px 10px;
}

.trcl-form-table th {
    padding: 20px 10px 20px 0;
    width: 200px;
}

.trcl-colour-preview {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    vertical-align: middle;
    margin-left: 8px;
    border: 1px solid #c3c4c7;
}

.trcl-lite-notice {
    background: #f0f6fc;
    border: 1px solid #72aee6;
    border-radius: 4px;
    padding: 16px;
    margin: 20px 0;
}

.trcl-lite-notice p {
    margin: 0 0 8px;
}

.trcl-lite-notice p:last-child {
    margin-bottom: 0;
}

/* ========================================
   General Admin
   ======================================== */

.trcl-admin-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f1;
    font-size: 12px;
    color: #787c82;
}

/* ========================================
   Appearance Tab (v2.1)
   ======================================== */

.trcl-position-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 160px));
    gap: 8px;
}

.trcl-position-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
}

.trcl-position-option:has(input:checked) {
    border-color: #10b981;
    background: #f0fdf4;
}

.trcl-range {
    vertical-align: middle;
    width: 220px;
    max-width: 60%;
}

.trcl-range-value {
    display: inline-block;
    min-width: 52px;
    margin-left: 10px;
    font-weight: 600;
    color: #1d2327;
}

/* ========================================
   Appearance — layout + avatar (v2.1)
   ======================================== */

.trcl-appearance-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.trcl-appearance-main {
    flex: 1 1 580px;
    min-width: 0;
}

.trcl-appearance-preview-col {
    flex: 0 1 auto;
    position: sticky;
    top: 48px;
}

@media (max-width: 1100px) {
    .trcl-appearance-layout {
        flex-direction: column;
    }
    .trcl-appearance-preview-col {
        position: static;
    }
}

.trcl-avatar-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trcl-avatar-preview img {
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #c3c4c7;
    background: #f0f0f1;
}

.trcl-reset-form {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #dcdcde;
}

/* ========================================
   Appearance — live preview (v2.1)
   ======================================== */

.trcl-pv-window {
    display: flex;
    flex-direction: column;
    width: var(--trcl-widget-width, 370px);
    max-width: 600px;
    height: var(--trcl-widget-height, 520px);
    max-height: 70vh;
    background: var(--trcl-window-bg, #fff);
    border-radius: var(--trcl-radius, 12px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
}

.trcl-pv-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--trcl-primary, #10B981);
    color: var(--trcl-header-text, #fff);
    flex-shrink: 0;
}

.trcl-pv-avatar img {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.2);
}

.trcl-pv-header-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.trcl-pv-name {
    font-weight: 600;
    font-size: 15px;
}

.trcl-pv-role {
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.trcl-pv-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trcl-pv-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    overflow-wrap: break-word;
}

.trcl-pv-msg--ai {
    background: var(--trcl-ai-bubble, #f3f4f6);
    color: var(--trcl-body-text, #1f2937);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.trcl-pv-msg--user {
    background: var(--trcl-user-bubble, var(--trcl-primary, #10B981));
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.trcl-pv-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.trcl-pv-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 8px 16px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trcl-pv-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--trcl-primary, #10B981);
    color: #fff;
    flex-shrink: 0;
}

.trcl-pv-note {
    margin-top: 8px;
}

/* ========================================
   Appearance — launcher style + preview (v2.1)
   ======================================== */

.trcl-launcher-grid {
    display: flex;
    gap: 8px;
}

.trcl-launcher-grid .trcl-position-option img {
    display: inline-block;
}

.trcl-launcher-bubble-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}

.trcl-pv-launcher-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.trcl-pv-launcher--brand img {
    display: block;
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.22));
}

.trcl-pv-launcher--bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--trcl-primary, #10B981);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
