/* Chat Widget - Perfect shadcn Design System */

/* Import design tokens from main app */
:root {
    /* Match main app design system */
    --radius: 0.625rem;
    --radius-sm: calc(var(--radius) - 4px);
    --radius-md: calc(var(--radius) - 2px);
    --radius-lg: var(--radius);
    --radius-xl: calc(var(--radius) + 4px);

    /* Brand colors from main app */
    --brand-primary: rgb(191, 254, 79);
    --brand-primary-foreground: rgb(10, 10, 10);

    /* Neutral system */
    --neutral-50: rgb(250, 248, 248);
    --neutral-100: rgb(243, 241, 242);
    --neutral-200: rgb(217, 215, 215);
    --neutral-300: rgb(175, 173, 174);
    --neutral-400: rgb(129, 128, 128);
    --neutral-500: rgb(88, 84, 85);
    --neutral-700: rgb(48, 45, 46);
    --neutral-800: rgb(26, 23, 24);
    --neutral-900: rgb(10, 10, 10);

    /* Semantic colors */
    --background: var(--neutral-50);
    --foreground: var(--neutral-800);
    --card: rgb(255, 255, 255);
    --card-foreground: var(--neutral-800);
    --muted: var(--neutral-100);
    --muted-foreground: var(--neutral-500);
    --border: var(--neutral-200);
    --input: var(--neutral-200);
    --ring: var(--neutral-500);
    --primary: var(--brand-primary);
    --primary-foreground: var(--brand-primary-foreground);
    --secondary: var(--neutral-100);
    --secondary-foreground: var(--neutral-800);
    --accent: var(--neutral-100);
    --accent-foreground: var(--neutral-800);
    --destructive: rgb(255, 0, 0);
    --destructive-foreground: rgb(255, 255, 255);

    /* Shadows - shadcn style */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 100ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
@supports (color: color(display-p3 0 0 0%)) {
:root {
    --destructive: rgb(255, 0, 0);
}

@media (color-gamut: p3) {
:root {
    --destructive: color(display-p3 0.91795 0.19935 0.13773);
}
}
}

/* Reset and base styles */
* {
    box-sizing: border-box;
}

.widget-container,
.widget-container * {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* Chat Button - shadcn style */
.widget-button {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    pointer-events: auto;
}

.widget-chat-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--foreground);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    outline: none;
    pointer-events: auto;
}

.widget-chat-button:hover {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-xl);
}

.widget-chat-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.widget-chat-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.widget-chat-button-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.widget-chat-button-text {
    font-weight: 500;
}

/* Chat Container - shadcn card style */
.widget-container {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    width: 384px;
    height: 600px;
    max-width: calc(100vw - 3rem);
    max-height: calc(100vh - 7rem);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    z-index: 999;
    transition: var(--transition-slow);
}

.widget-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.widget-closed {
    opacity: 0;
    transform: scale(0.96) translateY(0.5rem);
    pointer-events: none;
}

/* Main Content Card - perfect shadcn card */
.widget-content {
    width: 100%;
    height: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header - shadcn card header */
.widget-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.widget-header-content {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.widget-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-lg);
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.widget-title h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.5;
}

.widget-title p {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    line-height: 1.25;
}

.widget-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* shadcn button variants */
.widget-header-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.widget-header-button:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.widget-header-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.widget-header-button:active {
    transform: scale(0.95);
}

/* Messages Area - shadcn scroll area */
.widget-messages {
    flex: 1;
    overflow-y: auto;
    background: var(--muted);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.widget-messages::-webkit-scrollbar {
    width: 8px;
}

.widget-messages::-webkit-scrollbar-track {
    background: transparent;
}

.widget-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}

.widget-messages::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

/* Message Bubbles - shadcn card style */
.widget-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 100%;
    animation: fadeInUp 0.4s ease-out;
}

.widget-message-user {
    flex-direction: row-reverse;
}

.widget-message-content {
    max-width: 80%;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
            hyphens: auto;
    box-shadow: var(--shadow-sm);
}

.widget-message-assistant .widget-message-content {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--card-foreground);
    margin-left: 0.5rem;
}

.widget-message-user .widget-message-content {
    background: var(--primary);
    color: var(--primary-foreground);
    margin-right: 0.5rem;
    border: 1px solid var(--primary);
}


/* Enhanced markdown content */
.widget-message-content h1,
.widget-message-content h2,
.widget-message-content h3,
.widget-message-content h4,
.widget-message-content h5,
.widget-message-content h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.widget-message-content h1:first-child,
.widget-message-content h2:first-child,
.widget-message-content h3:first-child,
.widget-message-content h4:first-child,
.widget-message-content h5:first-child,
.widget-message-content h6:first-child {
    margin-top: 0;
}

.widget-message-content p {
    margin-bottom: 0.75rem;
}

.widget-message-content p:last-child {
    margin-bottom: 0;
}

.widget-message-content ul,
.widget-message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.widget-message-content li {
    margin: 0.25rem 0;
}

.widget-message-content strong {
    font-weight: 600;
}

.widget-message-content code {
    background: var(--muted);
    padding: 0.125rem 0.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.widget-message-content pre {
    background: var(--muted);
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid var(--border);
}

.widget-message-content pre code {
    background: transparent;
    padding: 0;
}

/* Typing Indicator - shadcn style */
.widget-typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 1rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-left: 0.5rem;
    width: -moz-fit-content;
    width: fit-content;
    box-shadow: var(--shadow-sm);
}

.widget-typing-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--muted-foreground);
    animation: typing 1.4s infinite ease-in-out;
}

.widget-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.widget-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-0.5rem);
        opacity: 1;
    }
}

/* Input Area - shadcn style */
.widget-input-container {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    flex-shrink: 0;
}

.widget-input-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* shadcn secondary button */
.widget-shortcut-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.875rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--secondary-foreground);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    white-space: nowrap;
}

.widget-shortcut-button:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.widget-shortcut-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.widget-shortcut-button:active {
    transform: scale(0.98);
}

.widget-input-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.widget-input-wrapper {
    flex: 1;
    position: relative;
}

/* shadcn input styling */
.widget-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 3rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--foreground);
    font-size: 0.875rem;
    line-height: 1.5;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.widget-input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.widget-input::-moz-placeholder {
    color: var(--muted-foreground);
}

.widget-input::placeholder {
    color: var(--muted-foreground);
}

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

.widget-attachment-button {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    outline: none;
}

.widget-attachment-button:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.widget-attachment-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* shadcn primary button */
.widget-send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    color: var(--primary-foreground);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    outline: none;
    box-shadow: var(--shadow-sm);
}

.widget-send-button:hover:not(:disabled) {
    background: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.widget-send-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.widget-send-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.widget-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Error States - shadcn alert style */
.widget-error {
    background: var(--destructive-foreground);
    border: 1px solid var(--destructive);
    color: var(--destructive);
    padding: 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    margin: 0.5rem 0;
    box-shadow: var(--shadow-sm);
}

.widget-error-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.widget-retry-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.875rem;
    background: var(--destructive);
    border: 1px solid var(--destructive);
    border-radius: var(--radius-md);
    color: var(--destructive-foreground);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.widget-retry-button:hover {
    background: var(--destructive);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.widget-retry-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .widget-container {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        /* Dynamic viewport height for keyboard support */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .widget-content {
        border-radius: 0;
        height: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        /* Dynamic viewport height for keyboard support */
    }

    .widget-button {
        bottom: 1rem;
        right: 1rem;
    }

    /* Hide the chat button when widget is open on mobile for full screen experience */
    .widget-container.widget-open~.widget-button {
        display: none;
    }

    .widget-header {
        padding: 1rem;
        flex-shrink: 0;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--card);
    }

    .widget-messages {
        padding: 1rem;
        flex: 1;
        min-height: 0;
        /* Allow flexbox to shrink below content size */
        overflow-y: auto;
        /* Ensure messages area takes available space but can compress for keyboard */
        height: auto;
    }

    .widget-input-container {
        padding: 1rem;
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        background: var(--card);
        border-top: 1px solid var(--border);
        /* Ensure input stays above virtual keyboard */
        margin-bottom: env(keyboard-inset-height, 0px);
    }

    .widget-message-content {
        max-width: 85%;
        padding: 0.875rem 1rem;
    }

    .widget-input-actions {
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    /* Better handling of viewport changes (keyboard appearing/disappearing) */
    .widget-content {
        transition: height 0.3s ease-out;
    }

    /* Ensure proper spacing when keyboard is active */
    @supports (height: 100dvh) {
        .widget-container {
            height: 100dvh;
        }

        .widget-content {
            min-height: 100dvh;
        }
    }

    /* Additional fallback for older browsers without dvh support */
    @supports not (height: 100dvh) {
        .widget-input-container {
            /* Fallback positioning for older browsers */
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 11;
        }

        .widget-messages {
            /* Add bottom padding to account for fixed input */
            padding-bottom: 6rem;
        }
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus management */
.widget-chat-button:focus,
.widget-header-button:focus,
.widget-input:focus,
.widget-send-button:focus,
.widget-attachment-button:focus,
.widget-shortcut-button:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Empty State */
.widget-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: var(--muted-foreground);
}

.widget-empty-state-icon {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.widget-empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.widget-empty-state-description {
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Structured Message Components */
.widget-structured-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.widget-structured-text {
    /* Inherits from message content styling */
}

.widget-structured-estimate,
.widget-structured-address,
.widget-structured-buttons,
.widget-structured-notification {
    margin: 0.5rem 0;
}

/* Estimate Card - Simplified */
.widget-estimate-card-simple {
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.widget-estimate-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
}

.widget-estimate-details-simple {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.widget-estimate-range-simple {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
}

.widget-estimate-button-simple {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.widget-estimate-button-simple:hover {
    background: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.widget-estimate-button-simple:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.widget-estimate-button-simple:active {
    transform: scale(0.98);
}

/* Address Input */
.widget-address-input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    max-width: 320px;
}

.widget-address-input-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.widget-address-input-container {
    position: relative;
}

.widget-address-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.widget-address-input-field {
    width: 100%;
    padding: 0.75rem;
    padding-right: 2.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--foreground);
    font-size: 0.875rem;
    line-height: 1.5;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.widget-address-input-field:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.widget-address-input-field::-moz-placeholder {
    color: var(--muted-foreground);
}

.widget-address-input-field::placeholder {
    color: var(--muted-foreground);
}

.widget-address-input-field:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.widget-address-input-icon-wrapper {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    color: var(--muted-foreground);
}

.widget-address-input-spinner {
    color: var(--primary);
}

.widget-address-input-search {
    color: var(--muted-foreground);
}

.widget-address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 12rem;
    overflow-y: auto;
    z-index: 50;
    margin-top: 0.25rem;
}

.widget-address-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.widget-address-suggestion:last-child {
    border-bottom: none;
}

.widget-address-suggestion:hover,
.widget-address-suggestion-selected {
    background: var(--accent);
    color: var(--accent-foreground);
}

.widget-address-suggestion-main {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.125rem;
}

.widget-address-suggestion-secondary {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.widget-address-suggestion:hover .widget-address-suggestion-secondary,
.widget-address-suggestion-selected .widget-address-suggestion-secondary {
    color: var(--muted-foreground);
}

.widget-address-manual {
    margin-top: 0.5rem;
}

.widget-address-manual-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--foreground);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.widget-address-manual-button:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.widget-address-manual-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Button Group */
.widget-button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.widget-button-group-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    border: 1px solid transparent;
    width: 100%;
}

.widget-button-group-item.widget-button-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.widget-button-group-item.widget-button-primary:hover {
    background: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.widget-button-group-item.widget-button-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}

.widget-button-group-item.widget-button-secondary:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.widget-button-group-item.widget-button-outline {
    background: transparent;
    color: var(--foreground);
    border-color: var(--border);
}

.widget-button-group-item.widget-button-outline:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.widget-button-group-item:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.widget-button-group-item:active {
    transform: scale(0.98);
}

/* Notification */
.widget-structured-notification {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.widget-notification-content {
    color: var(--foreground);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* File Upload Component */
.widget-file-upload {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    max-width: 320px;
    margin: 0.5rem 0;
}

.widget-file-upload-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
}

.widget-file-upload-header svg {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.widget-file-upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--muted);
    margin-bottom: 0.75rem;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-file-upload-dropzone:hover {
    border-color: var(--primary);
    background: var(--accent);
}

.widget-file-upload-dropzone-active {
    border-color: var(--primary);
    background: var(--primary);
    background-opacity: 0.1;
}

.widget-file-upload-dropzone-uploading {
    cursor: wait;
    opacity: 0.7;
}

.widget-file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.widget-file-upload-content svg {
    color: var(--muted-foreground);
}

.widget-file-upload-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.widget-file-upload-subtext {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.widget-file-upload-formats {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-style: italic;
}

.widget-file-upload-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.widget-file-upload-progress svg {
    color: var(--primary);
    animation: spin 2s linear infinite;
}

.widget-file-upload-progress span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.widget-file-upload-progress-bar {
    width: 100%;
    height: 0.25rem;
    background: var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 0.5rem;
}

.widget-file-upload-progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.widget-file-upload-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
}

.widget-file-upload-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--destructive-foreground);
    border: 1px solid var(--destructive);
    border-radius: var(--radius-md);
    color: var(--destructive);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.widget-file-upload-error svg {
    color: var(--destructive);
    flex-shrink: 0;
}

.widget-file-upload-success {
    margin-bottom: 0.75rem;
}

.widget-file-upload-success-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
}

.widget-file-upload-success-header svg {
    color: #10b981;
    flex-shrink: 0;
}

.widget-file-upload-files {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.widget-file-upload-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--foreground);
    font-size: 0.75rem;
    font-weight: 500;
}

.widget-file-upload-file svg {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.widget-file-upload-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.widget-file-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    border: 1px solid transparent;
    width: 100%;
}

.widget-file-upload-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.widget-file-upload-button-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.widget-file-upload-button-primary:hover:not(:disabled) {
    background: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.widget-file-upload-button-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}

.widget-file-upload-button-secondary:hover:not(:disabled) {
    background: var(--accent);
    color: var(--accent-foreground);
}

.widget-file-upload-button-skip {
    background: transparent;
    color: var(--muted-foreground);
    border-color: var(--border);
}

.widget-file-upload-button-skip:hover:not(:disabled) {
    background: var(--muted);
    color: var(--foreground);
}

.widget-file-upload-button:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.widget-file-upload-button:active:not(:disabled) {
    transform: scale(0.98);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Responsive adjustments for structured components */
@media (max-width: 480px) {

    .widget-estimate-card,
    .widget-address-input,
    .widget-file-upload {
        max-width: 100%;
    }

    .widget-estimate-actions {
        gap: 0.375rem;
    }

    .widget-estimate-button,
    .widget-button-group-item,
    .widget-file-upload-button {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }

    .widget-address-input-field {
        padding: 0.625rem;
        padding-right: 2.25rem;
    }

    .widget-file-upload-dropzone {
        padding: 1rem;
        min-height: 100px;
    }
}
