/* BlueRabbit - Component Styles */

/* ========================================
   CARDS
   ======================================== */

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    margin: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.card-body {
    padding: var(--space-4);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.stat-card.alert {
    border-color: var(--color-error);
    background: rgba(239, 68, 68, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.blue {
    background: rgba(67, 97, 238, 0.15);
    color: var(--color-primary);
}

.stat-icon.yellow {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
}

.stat-icon.green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
}

.stat-icon.purple {
    background: rgba(114, 9, 183, 0.15);
    color: #7209b7;
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    line-height: 1;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
    word-break: break-word;
}

/* ========================================
   LISTS
   ======================================== */

.list {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.list-item {
    display: flex;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
    transition: background var(--transition-fast);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--color-surface-hover);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--color-surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--space-3);
    flex-shrink: 0;
}

.list-item-icon svg {
    width: 20px;
    height: 20px;
    color: var(--color-text-muted);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: var(--font-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-arrow {
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    margin-left: var(--space-2);
    flex-shrink: 0;
}

.list-item-badge {
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--color-surface-hover);
    text-transform: capitalize;
    margin-left: var(--space-2);
    flex-shrink: 0;
}

.list-item-badge.completed, .list-item-badge.resolved, .list-item-badge.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
}

.list-item-badge.in_progress, .list-item-badge.assigned {
    background: rgba(67, 97, 238, 0.15);
    color: var(--color-primary);
}

.list-item-badge.pending, .list-item-badge.open, .list-item-badge.draft {
    background: rgba(250, 204, 21, 0.15);
    color: #ca8a04;
}

/* Status Dots */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-text-muted);
}

.status-dot.green { background: var(--color-success); }
.status-dot.yellow { background: #facc15; }
.status-dot.orange { background: #f97316; }
.status-dot.red { background: var(--color-error); }
.status-dot.gray { background: var(--color-text-muted); }

/* Priority Indicator */
.priority-indicator {
    width: 4px;
    height: 24px;
    border-radius: 2px;
    background: var(--color-text-muted);
}

.priority-indicator.critical { background: var(--color-error); }
.priority-indicator.high { background: #f97316; }
.priority-indicator.medium { background: #facc15; }
.priority-indicator.low { background: var(--color-success); }

.priority-badge {
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: capitalize;
}

.priority-badge.critical { background: rgba(239, 68, 68, 0.15); color: var(--color-error); }
.priority-badge.high { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.priority-badge.medium { background: rgba(250, 204, 21, 0.15); color: #ca8a04; }
.priority-badge.low { background: rgba(34, 197, 94, 0.15); color: var(--color-success); }

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    /* Allow text to wrap on long buttons, truncate if needed */
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: center;
    min-width: 0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-border);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-round {
    border-radius: 50%;
    width: 64px;
    height: 64px;
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-muted);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-input[type="date"],
.form-input[type="time"],
.form-input[type="datetime-local"] {
    min-height: 48px;
    -webkit-appearance: none;
    appearance: none;
}

.input-with-action {
    display: flex;
    gap: var(--space-2);
}

.input-with-action .form-input {
    flex: 1;
}

/* Option Buttons */
.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.option-btn {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
    min-width: 80px;
    text-align: center;
}

.option-btn:hover {
    border-color: var(--color-primary);
}

.option-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.option-btn.green.active { background: var(--color-success); border-color: var(--color-success); }
.option-btn.yellow.active { background: #facc15; border-color: #facc15; color: #000; }
.option-btn.orange.active { background: #f97316; border-color: #f97316; }
.option-btn.red.active { background: var(--color-error); border-color: var(--color-error); }

/* Toggle */
.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    width: 48px;
    height: 28px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition-fast);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.toggle-label input:checked + .toggle-switch {
    background: var(--color-primary);
}

.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(20px);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.checkbox-label input {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.checkbox-label input:checked + .checkbox-custom {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.form-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    outline: none;
}

.form-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
}

.slider-value {
    font-weight: var(--font-semibold);
    min-width: 40px;
    text-align: center;
}

/* ========================================
   QUICK ACTIONS
   ======================================== */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    padding: var(--space-4);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--color-surface-hover);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--color-border);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon svg {
    width: 24px;
    height: 24px;
}

.action-icon.blue { background: rgba(67, 97, 238, 0.15); color: var(--color-primary); }
.action-icon.yellow { background: rgba(250, 204, 21, 0.15); color: #ca8a04; }
.action-icon.green { background: rgba(34, 197, 94, 0.15); color: var(--color-success); }

.action-btn span {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

/* ========================================
   FILTER TABS
   ======================================== */

.filter-tabs {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding-bottom: var(--space-2);
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: var(--space-2) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    border-color: var(--color-primary);
}

.filter-tab.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* ========================================
   TIMELINE
   ======================================== */

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--color-border);
}

.timeline-item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-item-body {
    flex: 1;
    min-width: 0;
}

.timeline-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.timeline-item-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-item-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.timeline-item-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-4);
}

.empty-state-small {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--color-text-muted);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    background: var(--color-surface-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon svg {
    width: 32px;
    height: 32px;
    color: var(--color-text-muted);
}

.empty-state h4 {
    margin-bottom: var(--space-2);
}

.empty-state p {
    margin-bottom: var(--space-4);
}

/* ========================================
   TOASTS
   ======================================== */

.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-info { border-left: 4px solid var(--color-primary); }
.toast-success { border-left: 4px solid var(--color-success); }
.toast-warning { border-left: 4px solid #f97316; }
.toast-error { border-left: 4px solid var(--color-error); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: var(--font-semibold);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ========================================
   MODALS
   ======================================== */

.modal-container {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-container.hidden {
    display: none;
}

.modal-container.modal-top {
    align-items: flex-start;
    padding-top: 64px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal {
    position: relative;
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: calc(100% - 32px);
    max-height: calc(100vh - 48px);
    overflow: auto;
    box-shadow: var(--shadow-xl);
}

.modal.fullscreen {
    max-width: none;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.modal.fullscreen .modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.modal.fullscreen .modal-body .camera-container {
    height: 100%;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    margin: 0;
    font-size: var(--text-lg);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: var(--space-4);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.modal-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-4);
}

.modal-actions .btn {
    min-width: 100px;
}

/* Restore Prompt (for resuming in-progress inspections) */
.restore-prompt {
    text-align: center;
    padding: var(--space-4) 0;
}

.restore-prompt .restore-icon {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-4);
    color: var(--color-primary);
}

.restore-prompt h3 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-xl);
}

.restore-prompt p {
    color: var(--color-text-muted);
    margin: 0 0 var(--space-4);
}

.restore-prompt .restore-details {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.restore-prompt .restore-details span {
    background: var(--color-surface);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

/* ========================================
   AVATARS
   ======================================== */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.avatar.large {
    width: 80px;
    height: 80px;
    font-size: var(--text-2xl);
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    background: var(--color-surface-hover);
    text-transform: capitalize;
}

.badge.completed, .badge.resolved, .badge.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
}

.badge.in_progress, .badge.assigned {
    background: rgba(67, 97, 238, 0.15);
    color: var(--color-primary);
}

.badge.pending, .badge.open, .badge.draft {
    background: rgba(250, 204, 21, 0.15);
    color: #ca8a04;
}

.badge.cancelled, .badge.closed {
    background: var(--color-surface-hover);
    color: var(--color-text-muted);
}

/* ========================================
   LOADING
   ======================================== */

.loading-placeholder {
    text-align: center;
    padding: var(--space-10);
    color: var(--color-text-muted);
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

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

/* ========================================
   DETAIL CARDS
   ======================================== */

.detail-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-4);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-3);
}

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

.detail-label {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.detail-value {
    min-width: 0;
    text-align: right;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ========================================
   TEMPLATES
   ======================================== */

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
}

.template-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-fast);
}

.template-card:hover {
    border-color: var(--color-primary);
}

.template-icon {
    width: 48px;
    height: 48px;
    background: var(--color-surface-hover);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.template-icon svg {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

.template-name {
    font-weight: var(--font-semibold);
    margin-bottom: 4px;
}

.template-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.template-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========================================
   CAMERA & PHOTO
   ======================================== */

.camera-container {
    position: relative;
    background: #000;
    width: 100%;
    height: 100%;
    min-height: 300px;
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
}

.photo-capture {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.photo-preview {
    min-height: 100px;
    background: var(--color-surface-hover);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.photo-preview img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
}

.photo-buttons {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.photo-buttons .btn {
    flex: 1;
    min-width: 120px;
}

.photo-buttons label.btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.photo-upload {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Scanner */
.scanner-container {
    position: relative;
    background: #000;
    height: calc(100vh - 60px);
}

.scanner-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-frame {
    width: 250px;
    height: 250px;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-result {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    background: var(--color-surface);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
}

/* ========================================
   SIGNATURE PAD
   ======================================== */

.signature-pad-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
}

.signature-canvas {
    display: block;
    width: 100%;
    height: 150px;
    min-height: 150px;
    background: var(--color-surface-hover, #2a2a3e);
    border: 2px dashed var(--color-border-hover, rgba(255,255,255,0.15));
    border-radius: var(--radius-md);
    touch-action: none;
    cursor: crosshair;
}

/* ========================================
   QUESTION TYPE PICKER
   ======================================== */

.question-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
}

.question-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.question-type-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
}

.type-icon {
    font-size: 24px;
}

.type-name {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

/* ========================================
   CHARTS
   ======================================== */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    padding: var(--space-4);
}

.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */

.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-border);
    transition: var(--transition-fast);
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: var(--color-primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.toggle input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   ACTION BUTTONS
   ======================================== */

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.action-buttons .btn {
    flex: 1;
    min-width: 120px;
}

.action-buttons .btn svg {
    margin-right: var(--space-2);
}

/* ========================================
   RESPONSES LIST
   ======================================== */

.responses-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.response-item {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: var(--space-3);
}

.response-item.flagged {
    border-left: 3px solid var(--color-danger);
}

.response-question {
    font-weight: var(--font-medium);
    margin-bottom: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.response-value {
    font-size: var(--text-base);
    word-break: break-word;
    overflow-wrap: break-word;
}

.response-note {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-style: italic;
}

/* ========================================
   ISSUE & WORK ORDER HEADERS
   ======================================== */

.issue-header,
.wo-header {
    margin-bottom: var(--space-4);
}

.issue-header h2,
.wo-header h2 {
    margin: var(--space-2) 0;
    font-size: var(--text-xl);
}

.issue-desc,
.wo-desc {
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
    line-height: 1.6;
}

/* ========================================
   RESPONSIVE FIXES
   ======================================== */

@media (max-width: 480px) {
    .question-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 320px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   CHIPS / TAGS (Multi-issue linking)
   ======================================== */

.linked-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(67, 97, 238, 0.15);
    color: var(--color-primary);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    max-width: 200px;
}

.chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip-remove {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.7;
}

.chip-remove:hover {
    opacity: 1;
}

/* ========================================
   ISSUE PICKER (WO form)
   ======================================== */

.issue-picker {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.issue-pick-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    font-size: var(--text-sm);
}

.issue-pick-item:last-child {
    border-bottom: none;
}

.issue-pick-item:hover {
    background: var(--color-surface-hover);
}

.issue-pick-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px !important;
    height: 18px;
    min-width: 18px;
    margin-top: 1px;
    padding: 0 !important;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.issue-pick-title {
    flex: 1;
    min-width: 0;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.issue-pick-item .priority-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    margin-left: auto;
}

/* ========================================
   WORK ORDER TIMELINE
   ======================================== */

.wo-timeline {
    padding: var(--space-3) var(--space-4);
}

.wo-timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.wo-timeline-item:last-child {
    border-bottom: none;
}

.wo-timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--color-surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.wo-timeline-body {
    flex: 1;
    min-width: 0;
}

.wo-timeline-desc {
    font-size: var(--text-sm);
    line-height: 1.4;
}

.wo-timeline-desc strong {
    font-weight: var(--font-semibold);
}

.wo-timeline-note {
    margin-top: 4px;
    padding: 8px 12px;
    background: var(--color-surface-hover);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    word-break: break-word;
}

.wo-timeline-date {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* ========================================
   DOCUMENT LIST (Property documents)
   ======================================== */

.doc-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.doc-item .list-item-icon {
    background: transparent;
}

.doc-item .list-item-content {
    cursor: pointer;
}
