/* Scoped Variables */
#hs-plugin-root {
    --hs-bg: #0f172a;
    --hs-card-bg: #1e293b;
    --hs-text: #f8fafc;
    --hs-text-muted: #94a3b8;
    --hs-primary: #3b82f6;
    --hs-primary-hover: #2563eb;
    --hs-success: #22c55e;
    --hs-danger: #ef4444;
    --hs-border: #334155;
    --hs-radius: 12px;
}

/* Container & Reset */
#hs-plugin-root {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    background: var(--hs-bg) !important;
    color: var(--hs-text) !important;
    padding: 2rem !important;
    border-radius: var(--hs-radius) !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 2rem 0 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    line-height: 1.5 !important;
}

#hs-plugin-root *,
#hs-plugin-root *::before,
#hs-plugin-root *::after {
    box-sizing: border-box;
}

/* Typography Resets */
#hs-plugin-root h2,
#hs-plugin-root h3,
#hs-plugin-root p {
    margin: 0;
    padding: 0;
    color: inherit;
}

/* Header */
#hs-plugin-root .hs-header {
    text-align: center !important;
    margin-bottom: 2rem !important;
}

#hs-plugin-root .hs-header h2 {
    font-size: 2rem !important;
    font-weight: 700 !important;
    color: var(--hs-text) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    line-height: 1.2 !important;
}

#hs-plugin-root .hs-badge {
    background: var(--hs-primary) !important;
    color: white !important;
    font-size: 0.8rem !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: 4px !important;
    text-transform: uppercase !important;
    font-weight: bold !important;
    vertical-align: middle !important;
}

#hs-plugin-root .hs-header p {
    color: var(--hs-text-muted) !important;
    margin-top: 0.5rem !important;
    font-size: 1rem !important;
}

/* Upload Zone */
#hs-plugin-root .hs-upload-zone {
    border: 2px dashed var(--hs-border) !important;
    border-radius: var(--hs-radius) !important;
    padding: 4rem 2rem !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    background: rgba(30, 41, 59, 0.5) !important;
    margin-bottom: 2rem !important;
}

#hs-plugin-root .hs-upload-zone:hover {
    border-color: var(--hs-primary) !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

#hs-plugin-root .hs-upload-content svg {
    color: var(--hs-text-muted) !important;
    margin-bottom: 1rem !important;
    width: 48px !important;
    height: 48px !important;
}

#hs-plugin-root .hs-upload-content p {
    color: var(--hs-text) !important;
}

#hs-plugin-root .hs-upload-content p span {
    color: var(--hs-primary) !important;
    font-weight: 600 !important;
    text-decoration: underline !important;
}

/* Controls */
#hs-plugin-root .hs-controls {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 2rem !important;
    background: var(--hs-card-bg) !important;
    padding: 1.5rem !important;
    border-radius: var(--hs-radius) !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
}

#hs-plugin-root .hs-control-group {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
}

#hs-plugin-root .hs-control-group label {
    color: var(--hs-text) !important;
    font-weight: 500 !important;
}

#hs-plugin-root input[type="range"] {
    accent-color: var(--hs-primary) !important;
}

#hs-plugin-root .hs-actions {
    display: flex !important;
    gap: 1rem !important;
}

/* Buttons */
#hs-plugin-root .hs-btn {
    padding: 0.75rem 1.5rem !important;
    border-radius: 8px !important;
    border: none !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    transition: transform 0.1s !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    text-decoration: none !important;
}

#hs-plugin-root .hs-btn:active {
    transform: scale(0.98) !important;
}

#hs-plugin-root .hs-btn-primary {
    background: var(--hs-primary) !important;
    color: white !important;
}

#hs-plugin-root .hs-btn-primary:hover {
    background: var(--hs-primary-hover) !important;
}

#hs-plugin-root .hs-btn-secondary {
    background: var(--hs-border) !important;
    color: var(--hs-text) !important;
}

#hs-plugin-root .hs-btn-secondary:hover {
    background: #475569 !important;
}

/* Preview Area */
#hs-plugin-root .hs-preview-area {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
    margin-bottom: 3rem !important;
}

@media (max-width: 768px) {
    #hs-plugin-root .hs-preview-area {
        grid-template-columns: 1fr !important;
    }

    #hs-plugin-root .hs-controls {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    #hs-plugin-root .hs-actions {
        flex-direction: column !important;
    }
}

#hs-plugin-root .hs-card {
    background: var(--hs-card-bg) !important;
    border-radius: var(--hs-radius) !important;
    overflow: hidden !important;
    border: 1px solid var(--hs-border) !important;
}

#hs-plugin-root .hs-card-header {
    padding: 1rem !important;
    background: rgba(0, 0, 0, 0.2) !important;
    font-weight: 600 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    color: var(--hs-text) !important;
}

#hs-plugin-root .hs-status-badge {
    font-size: 0.8rem !important;
    padding: 0.2rem 0.6rem !important;
    border-radius: 20px !important;
    background: var(--hs-border) !important;
    color: var(--hs-text) !important;
}

#hs-plugin-root .hs-status-badge.safe {
    background: var(--hs-success) !important;
    color: #000 !important;
}

#hs-plugin-root .hs-status-badge.risky {
    background: var(--hs-danger) !important;
    color: white !important;
}

#hs-plugin-root .hs-image-wrapper {
    height: 300px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #000 !important;
    overflow: hidden !important;
}

#hs-plugin-root .hs-image-wrapper img,
#hs-plugin-root .hs-image-wrapper canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

#hs-plugin-root .hs-stats {
    padding: 1.5rem !important;
}

#hs-plugin-root .hs-stat-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 0.5rem !important;
    font-family: monospace !important;
    font-size: 0.9rem !important;
    color: var(--hs-text) !important;
}

#hs-plugin-root .hs-stat-row code {
    color: var(--hs-text-muted) !important;
    background: rgba(0, 0, 0, 0.3) !important;
    padding: 0.2rem 0.4rem !important;
    border-radius: 4px !important;
    max-width: 150px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    border: none !important;
}

#hs-plugin-root .hs-diff {
    font-weight: bold !important;
    color: var(--hs-text-muted) !important;
}

/* History */
#hs-plugin-root .hs-history-section {
    border-top: 1px solid var(--hs-border) !important;
    padding-top: 2rem !important;
}

#hs-plugin-root .hs-history-section h3 {
    color: var(--hs-text) !important;
    margin-bottom: 1rem !important;
    font-size: 1.25rem !important;
}

#hs-plugin-root .hs-history-list {
    margin-top: 1rem !important;
    display: grid !important;
    gap: 1rem !important;
    max-height: 400px !important;
    overflow-y: auto !important;
}

#hs-plugin-root .hs-history-item {
    background: var(--hs-card-bg) !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border: 1px solid var(--hs-border) !important;
}

#hs-plugin-root .hs-history-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.2rem !important;
}

#hs-plugin-root .hs-history-info strong {
    color: var(--hs-text) !important;
}

#hs-plugin-root .hs-history-date {
    font-size: 0.8rem !important;
    color: var(--hs-text-muted) !important;
}

#hs-plugin-root .hs-text-btn {
    background: none !important;
    border: none !important;
    color: var(--hs-text-muted) !important;
    cursor: pointer !important;
    margin-top: 1rem !important;
    text-decoration: underline !important;
    font-size: 0.9rem !important;
    padding: 0 !important;
}

#hs-plugin-root .hs-text-btn:hover {
    color: var(--hs-text) !important;
}

#hs-plugin-root .hs-empty-state {
    color: var(--hs-text-muted) !important;
    font-style: italic !important;
}