/* inqiro Client - Admin Styles */

.iq-wrap { max-width: 1200px; }
.iq-wrap h1 { font-size: 24px; margin-bottom: 20px; }

.iq-card { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.iq-card h2 { margin-top: 0; font-size: 16px; padding-bottom: 10px; border-bottom: 1px solid #eee; margin-bottom: 15px; }

.iq-row { display: flex; gap: 20px; flex-wrap: wrap; }
.iq-col-4 { flex: 0 0 320px; }
.iq-col-6 { flex: 1; min-width: 300px; }
.iq-col-8 { flex: 2; min-width: 400px; }

.iq-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.iq-stat-card { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 16px; text-align: center; }
.iq-stat-number { font-size: 24px; font-weight: 700; color: #1e40af; }
.iq-stat-label { font-size: 12px; color: #6b7280; margin-top: 2px; }
.iq-stat-detail { font-size: 11px; color: #9ca3af; margin-top: 4px; }

.iq-license-bar { padding: 10px 16px; border-radius: 8px; margin-bottom: 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 14px; }
.iq-tier-free { background: #f3f4f6; border: 1px solid #d1d5db; }
.iq-tier-pro { background: #eff6ff; border: 1px solid #93c5fd; }
.iq-tier-business { background: #f5f3ff; border: 1px solid #c4b5fd; }

.iq-badge-pro { display: inline-block; padding: 1px 6px; background: #3b82f6; color: #fff; border-radius: 3px; font-size: 10px; font-weight: 600; vertical-align: middle; margin-left: 6px; text-decoration: none; transition: background 0.2s; }
a.iq-badge-pro:hover { background: #2563eb; color: #fff; }

.iq-progress-msg { padding: 10px; background: #f0f7ff; border: 1px solid #c3dafe; border-radius: 6px; font-size: 13px; }
.iq-progress-msg.error { background: #fef2f2; border-color: #fca5a5; }

/* Session list */
.iq-session-list { max-height: 600px; overflow-y: auto; }
.iq-session-item { display: block; padding: 10px 12px; border-bottom: 1px solid #f3f4f6; text-decoration: none; color: inherit; transition: background 0.1s; }
.iq-session-item:hover, .iq-session-item.active { background: #eff6ff; }
.iq-session-meta { display: flex; justify-content: space-between; font-size: 12px; color: #6b7280; margin-bottom: 2px; }
.iq-session-page { font-size: 13px; color: #374151; }

/* Chat viewer */
.iq-chat-viewer { max-height: 600px; overflow-y: auto; padding: 10px; }
.iq-chat-msg { margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; max-width: 80%; }
.iq-chat-user { background: #eff6ff; margin-left: auto; border-bottom-right-radius: 2px; }
.iq-chat-assistant { background: #f3f4f6; margin-right: auto; border-bottom-left-radius: 2px; }
.iq-chat-role { font-size: 11px; font-weight: 600; color: #6b7280; margin-bottom: 4px; }
.iq-chat-text { font-size: 14px; line-height: 1.5; }
.iq-chat-time { font-size: 10px; color: #9ca3af; margin-top: 4px; }

/* License section */
.iq-license-active { padding: 12px; background: #f0fdf4; border: 1px solid #86efac; border-radius: 6px; }
.iq-license-inactive { padding: 12px; }

/* Document upload */
.iq-doc-upload-form .form-table th { width: 120px; padding: 10px 10px 10px 0; }
.iq-doc-upload-form .form-table td { padding: 10px 0; }

/* Usage progress bar */
.iq-usage-bar { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 14px 18px; margin-bottom: 20px; }
.iq-usage-header { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #374151; margin-bottom: 8px; }
.iq-usage-track { height: 10px; background: #e5e7eb; border-radius: 5px; overflow: hidden; }
.iq-usage-fill { height: 100%; background: #3b82f6; border-radius: 5px; transition: width 0.5s ease; }
.iq-usage-fill.iq-usage-warning { background: #f59e0b; }
.iq-usage-fill.iq-usage-full { background: #ef4444; }
.iq-usage-hint { font-size: 12px; margin: 8px 0 0; line-height: 1.5; }
.iq-usage-hint a { text-decoration: none; font-weight: 600; }
.iq-usage-hint-warning { color: #92400e; }
.iq-usage-hint-warning a { color: #d97706; }
.iq-usage-hint-full { color: #991b1b; }
.iq-usage-hint-full a { color: #dc2626; }

/* Tabs */
.iq-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #e5e7eb; }
.iq-tab { padding: 10px 20px; text-decoration: none; color: #6b7280; font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.15s, border-color 0.15s; }
.iq-tab:hover { color: #374151; }
.iq-tab.active { color: #1e40af; border-bottom-color: #3b82f6; font-weight: 600; }

/* Handoff status badges */
.iq-status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.iq-status-pending { background: #fef3c7; color: #92400e; }
.iq-status-in_progress { background: #dbeafe; color: #1e40af; }
.iq-status-resolved { background: #d1fae5; color: #065f46; }
.iq-status-closed { background: #f3f4f6; color: #6b7280; }

/* Admin bar handoff badge */
#wpadminbar .iq-handoff-badge { display: inline-block; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 10px; margin-left: 6px; line-height: 18px; min-width: 18px; text-align: center; }

/* Handoff notes */
.iq-handoff-notes { font-size: 12px; min-width: 150px; }

/* Multi-select component */
.iq-multi-select { position: relative; }
.iq-ms-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.iq-ms-chips:empty { display: none; }
.iq-ms-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 4px; font-size: 13px; color: #1e40af; line-height: 1.3; }
.iq-ms-chip-meta { color: #6b7280; font-size: 11px; }
.iq-ms-chip-remove { background: none; border: none; cursor: pointer; color: #93c5fd; font-size: 16px; line-height: 1; padding: 0 2px; transition: color 0.15s; }
.iq-ms-chip-remove:hover { color: #dc2626; }
.iq-ms-input { width: 100%; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px; box-sizing: border-box; }
.iq-ms-input:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 1px #3b82f6; }
.iq-ms-dropdown { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 100; background: #fff; border: 1px solid #d1d5db; border-top: none; border-radius: 0 0 4px 4px; max-height: 240px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.iq-ms-dropdown.open { display: block; }
.iq-ms-option { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f3f4f6; transition: background 0.1s; }
.iq-ms-option:last-child { border-bottom: none; }
.iq-ms-option:hover { background: #eff6ff; }
.iq-ms-option-meta { color: #9ca3af; font-size: 11px; margin-left: 6px; }
.iq-ms-empty { padding: 10px 12px; color: #9ca3af; font-size: 13px; font-style: italic; }

/* Avatar upload */
.iq-avatar-upload { display: flex; align-items: center; gap: 12px; }
.iq-avatar-preview { position: relative; width: 48px; height: 48px; flex-shrink: 0; }
.iq-avatar-preview img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid #ddd; }
.iq-avatar-remove { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: #ef4444; color: #fff; border: none; font-size: 14px; line-height: 18px; cursor: pointer; padding: 0; text-align: center; }
.iq-avatar-remove:hover { background: #dc2626; }

/* KPI row */
.iq-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.iq-kpi-card { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 18px 16px; text-align: center; }
.iq-kpi-number { font-size: 28px; font-weight: 700; color: #1e40af; }
.iq-kpi-label { font-size: 12px; color: #6b7280; margin-top: 4px; }

/* Period selector */
.iq-period-selector { display: flex; gap: 0; margin-bottom: 16px; }
.iq-period-btn { padding: 6px 16px; background: #fff; border: 1px solid #d1d5db; color: #374151; font-size: 13px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.iq-period-btn:first-child { border-radius: 6px 0 0 6px; }
.iq-period-btn:last-child { border-radius: 0 6px 6px 0; }
.iq-period-btn:not(:first-child) { margin-left: -1px; }
.iq-period-btn:hover { background: #f3f4f6; }
.iq-period-btn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; z-index: 1; position: relative; }

/* Chart cards */
.iq-chart-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-start; }
.iq-chart-card { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 16px; flex: 1; min-width: 250px; position: relative; }
.iq-chart-card h3 { margin: 0 0 12px; font-size: 14px; color: #374151; }
.iq-chart-card canvas { width: 100% !important; max-height: 260px; }
.iq-chart-wide { flex: 1 1 100%; }

/* Upgrade nudge */
.iq-upgrade-nudge { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 6px; font-size: 13px; color: #92400e; margin-bottom: 16px; }
.iq-upgrade-nudge a { color: #d97706; font-weight: 600; text-decoration: none; white-space: nowrap; }
.iq-upgrade-nudge a:hover { color: #b45309; text-decoration: underline; }
.iq-card.iq-card-locked { opacity: 0.7; }
.iq-card.iq-card-locked .form-table input,
.iq-card.iq-card-locked .form-table select,
.iq-card.iq-card-locked .form-table textarea,
.iq-card.iq-card-locked .form-table button,
.iq-card.iq-card-locked .button { pointer-events: none; opacity: 0.5; }
.iq-card.iq-card-locked .iq-upgrade-nudge { opacity: 1; }
.iq-card.iq-card-locked .iq-upgrade-nudge a { pointer-events: auto; }

/* Tier section dividers */
.iq-tier-divider { display: flex; align-items: center; gap: 12px; margin: 30px 0 10px; }
.iq-tier-divider::after { content: ''; flex: 1; height: 1px; background: #e5e7eb; }
.iq-tier-label { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 4px 12px; border-radius: 4px; white-space: nowrap; }
.iq-tier-label-pro { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
.iq-tier-label-business { background: #f5f3ff; color: #5b21b6; border: 1px solid #c4b5fd; }

/* Help tooltips */
.iq-help { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: #e5e7eb; color: #6b7280; font-size: 11px; font-weight: 700; cursor: help; margin-left: 4px; position: relative; vertical-align: middle; line-height: 1; font-style: normal; }
.iq-help:hover { background: #3b82f6; color: #fff; }
.iq-help::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); padding: 8px 12px; background: #1f2937; color: #fff; font-size: 12px; font-weight: 400; border-radius: 6px; white-space: normal; width: max-content; max-width: 260px; z-index: 100000; line-height: 1.4; text-align: left; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.iq-help::before { content: ''; position: absolute; left: 50%; bottom: calc(100% + 1px); transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1f2937; z-index: 100000; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.iq-help:hover::after, .iq-help:hover::before { opacity: 1; }

@media screen and (max-width: 782px) {
    .iq-row { flex-direction: column; }
    .iq-col-4, .iq-col-8 { flex: 1; min-width: 0; }
    .iq-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .iq-chart-row { flex-direction: column; }
    .iq-chart-card { min-width: 0; }
}
