/* Alpine.js x-cloak utility */
[x-cloak] {
    display: none !important;
}

/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Design System Variables - iOS Inspired */
:root {
    /* iOS Dark Mode Colors */
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --bg-elevated: #3A3A3C;
    --text-primary: #FFFFFF;
    --text-secondary: #EBEBF5;
    --text-tertiary: #EBEBF599;
    --accent: #0A84FF;
    --accent-highlight: #64D2FF;
    --success: #30D158;
    --danger: #FF453A;
    --warning: #FFD60A;
    --purple: #BF5AF2;
    --pink: #FF375F;
    
    /* Spacing */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-6: 48px;
    --space-8: 64px;
}

/* Light Theme for Signup Forms */
.signup-form-light {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F2F2F7;
    --bg-tertiary: #E5E5EA;
    --bg-elevated: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #3C3C43;
    --text-tertiary: rgba(60, 60, 67, 0.6);
    --border: rgba(0, 0, 0, 0.1);
    background-image: none;
    background: var(--bg-secondary);
}

.signup-form-light .glass-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.signup-form-light input,
.signup-form-light textarea,
.signup-form-light select {
    background-color: var(--bg-secondary) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: var(--text-primary) !important;
}

.signup-form-light input:focus,
.signup-form-light textarea:focus,
.signup-form-light select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15) !important;
}

.signup-form-light .text-gray-600 {
    color: #666666 !important;
}

.signup-form-light .bg-blue-50,
.signup-form-light .dark\:bg-blue-900\/20 {
    background-color: rgba(10, 132, 255, 0.1) !important;
}

.signup-form-light .text-blue-800,
.signup-form-light .dark\:text-blue-200 {
    color: var(--accent) !important;
}

/* Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 17px;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 20% 80%, rgba(10, 132, 255, 0.15) 0px, transparent 50%),
        radial-gradient(at 80% 20%, rgba(191, 90, 242, 0.1) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(255, 55, 95, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3);
}

.auth-card {
    background: rgba(28, 28, 30, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: var(--space-5);
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.auth-logo {
    font-size: 64px;
    text-align: center;
    margin-bottom: var(--space-3);
}

.auth-title {
    font-size: 34px;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-1);
}

.auth-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--space-4);
}

.auth-form {
    margin-bottom: var(--space-3);
}

.auth-footer {
    text-align: center;
    color: var(--text-secondary);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-3);
}

.form-row {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    margin-bottom: var(--space-3);
}

@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
    }
    .form-row .form-group {
        width: 100% !important;
        flex: 1 !important;
    }
}

.input {
    width: 100%;
    padding: 16px;
    background: var(--bg-elevated);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 17px;
    transition: all 0.2s ease;
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.3),
               0 0 20px rgba(10, 132, 255, 0.2);
    background: rgba(58, 58, 60, 0.8);
}

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

.input-highlight {
    border-color: var(--warning) !important;
    box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.2) !important;
    animation: pulse-highlight 2s ease-in-out;
}

@keyframes pulse-highlight {
    0%, 100% {
        border-color: var(--warning);
        box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.2);
    }
    50% {
        border-color: var(--warning);
        box-shadow: 0 0 0 5px rgba(255, 214, 10, 0.3);
    }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 17px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-primary:hover {
    background: #0071E3;
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 8px 20px rgba(10, 132, 255, 0.4),
               inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
    border-radius: 14px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

/* Links */
.link {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.link:hover {
    opacity: 0.8;
}

/* Loading State */
.htmx-request .btn {
    opacity: 0.6;
    cursor: not-allowed;
}

.htmx-request .btn::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .auth-card {
        padding: var(--space-4);
    }
    
    .auth-title {
        font-size: 28px;
    }
    
    .auth-logo {
        font-size: 48px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Three-Dot Menu Styles */
.menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-radius: 6px;
}

.menu-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(44, 44, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 8px;
    min-width: 200px;
    z-index: 100;
    margin-top: 4px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 8px;
    gap: 10px;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dropdown-icon {
    width: 20px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* Update list-actions to support dropdown */
.list-actions {
    position: relative;
}

/* Signup Form Modal Styles */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.form-help-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.field-config-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.field-name {
    font-weight: 500;
    color: var(--text-primary);
}

.field-controls {
    display: flex;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.signup-url-display {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 256px;
}

/* Glass Card Component */
.glass-card {
    background: rgba(28, 28, 30, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: var(--space-4);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

/* Container */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Utility classes for signup form */
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.max-w-md {
    max-width: 28rem;
}

.min-h-screen {
    min-height: 100vh;
}

.text-center {
    text-align: center;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.text-gray-600 {
    color: #4B5563;
}

.text-gray-500 {
    color: #6B7280;
}

.text-gray-400 {
    color: #9CA3AF;
}

.text-red-500 {
    color: #EF4444;
}

.text-blue-800 {
    color: #1E40AF;
}

.text-blue-200 {
    color: #BFDBFE;
}

.text-white {
    color: #FFFFFF;
}

.bg-blue-50 {
    background-color: #EFF6FF;
}

.bg-gray-50 {
    background-color: #F9FAFB;
}

.dark\:bg-blue-900\/20 {
    background-color: rgba(30, 58, 138, 0.2);
}

.dark\:bg-gray-800\/50 {
    background-color: rgba(31, 41, 55, 0.5);
}

.dark\:text-gray-400 {
    color: #9CA3AF;
}

.dark\:text-blue-200 {
    color: #BFDBFE;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mr-3 {
    margin-right: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.w-full {
    width: 100%;
}

.w-5 {
    width: 1.25rem;
}

.h-5 {
    height: 1.25rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-center {
    justify-content: center;
}

.block {
    display: block;
}

.cursor-pointer {
    cursor: pointer;
}

.border {
    border-width: 1px;
}

.border-gray-300 {
    border-color: #D1D5DB;
}

.focus\:outline-none:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.focus\:ring-2:focus {
    box-shadow: 0 0 0 2px var(--accent);
}

.hover\:opacity-90:hover {
    opacity: 0.9;
}

.disabled\:opacity-50:disabled {
    opacity: 0.5;
}

.disabled\:cursor-not-allowed:disabled {
    cursor: not-allowed;
}

.transition {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.duration-200 {
    transition-duration: 200ms;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

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

/* Fix input backgrounds for dark mode */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
    background-color: var(--bg-secondary);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

input[type="checkbox"] {
    background-color: var(--bg-secondary);
    border-color: rgba(255, 255, 255, 0.2);
}

input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* Fix signup form button styling */
.bg-\[var\(--primary\)\] {
    background-color: var(--accent) !important;
}

button[type="submit"] {
    background-color: var(--accent);
    color: white;
    border: none;
}

button[type="submit"]:hover:not(:disabled) {
    background-color: #0051D5;
    opacity: 1;
}

button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* iOS Toggle Switch */
.toggle-switch {
    position: relative;
    width: 51px;
    height: 31px;
    background: rgba(120, 120, 128, 0.3);
    border-radius: 31px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    transition: background-color 0.3s ease;
}

.toggle-switch:checked {
    background: var(--success);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

/* Field Configuration Styles */
.field-config-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 12px;
}

.field-config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(58, 58, 60, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.field-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 100px;
}

.field-controls {
    display: flex;
    gap: 24px;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.toggle-label input {
    margin: 0;
}

/* Template Variables UI */
.variable-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.variable-btn {
    padding: 6px 12px;
    background: rgba(10, 132, 255, 0.2);
    color: var(--accent);
    border: 1px solid rgba(10, 132, 255, 0.3);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'SF Mono', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.variable-btn:hover {
    background: rgba(10, 132, 255, 0.3);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
}

.variable-btn:active {
    transform: translateY(0);
}

/* Template Card Styles */
.template-card {
    background: rgba(44, 44, 46, 0.3);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.template-card:hover {
    background: rgba(44, 44, 46, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.template-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.template-actions {
    display: flex;
    gap: 8px;
}

.template-content {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.template-footer {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.template-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.templates-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.variables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.variable-badge {
    background: rgba(10, 132, 255, 0.2);
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'SF Mono', monospace;
}

/* Template Toolbar */
.template-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

@media (max-width: 768px) {
    .template-toolbar {
        flex-direction: column;
    }
    .template-toolbar .dropdown,
    .template-toolbar .btn {
        width: 100%;
    }
    .template-toolbar .dropdown .btn {
        width: 100%;
    }
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

/* Message Form Enhancements */
.message-textarea-wrapper {
    position: relative;
}

/* Inline Character Counter */
.character-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    pointer-events: none;
}

.character-count.warning {
    color: var(--warning);
}

.textarea {
    min-height: 100px;
    resize: vertical;
    padding-bottom: 36px; /* Make room for character counter */
}

/* Variable Highlighting in textarea (visual hint) */
.textarea-hint {
    position: absolute;
    inset: 0;
    padding: 16px;
    padding-bottom: 36px;
    pointer-events: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: transparent;
    z-index: 1;
}

.variable-highlight {
    color: var(--accent);
    font-weight: 600;
}

/* Templates Dropdown */
.templates-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 280px;
    max-width: 360px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.dropdown-section {
    padding: 8px;
}

.dropdown-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 4px;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.template-dropdown-item {
    padding: 12px;
    background: none;
    border: none;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.template-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.template-dropdown-item:active {
    background: rgba(255, 255, 255, 0.1);
}

.template-dropdown-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.template-dropdown-preview {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.template-dropdown-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.dropdown-toggle {
    position: relative;
}

/* Empty state for dropdown */
.templates-dropdown-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* Variable highlighting in textarea */
.textarea.has-variables {
    color: var(--text-primary);
    caret-color: var(--accent);
}

/* Visual indicator for templates with variables */
.has-variables::placeholder {
    color: var(--accent-highlight);
}

/* Prevent body scroll when modal is open */
body.no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Fix list card z-index to ensure dropdowns appear above */
.list-card {
    position: relative;
    z-index: 1;
}

/* When menu is open, bump card's z-index so dropdown appears above sibling cards */
.list-card.menu-open {
    z-index: 100;
}

/* Ensure dropdown menus are above list cards but below modals */
.list-actions {
    position: relative;
    z-index: 10;
}

.list-actions .dropdown-menu {
    z-index: 50;
    position: absolute;
    top: 100%;
    right: 0;
}

/* Removed textarea variable highlighting - now only shown in preview modal */

/* Preview Message Modal Styles */
.preview-message-box {
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    min-height: 80px;
    word-wrap: break-word;
}

.message-stats {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
}

.message-stats .stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.message-stats .stat-item:last-child {
    margin-bottom: 0;
}

.preview-variables {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-variables .variable-badge {
    background: rgba(10, 132, 255, 0.2);
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'SF Mono', monospace;
}

/* Highlight replaced variables in preview text */
.preview-variable-highlight {
    background: rgba(10, 132, 255, 0.2);
    color: var(--accent);
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* Recipients preview styles */
.preview-recipients {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.recipients-summary {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 14px;
}

.recipient-item {
    padding: 4px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.recipient-more {
    padding: 8px 0;
    text-align: center;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.link-btn:hover {
    background: rgba(10, 132, 255, 0.1);
    text-decoration: underline;
}

/* Changelog Toast */
.changelog-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    background: rgba(44, 44, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    z-index: 999;
}

.changelog-toast-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.changelog-toast-icon {
    font-size: 20px;
}

.changelog-toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.changelog-toast-close:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.changelog-toast-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.changelog-toast-list li {
    margin-bottom: 4px;
}

.changelog-toast-link {
    display: block;
    margin-top: 12px;
    color: var(--accent);
    font-size: 14px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.changelog-toast-link:hover {
    opacity: 0.8;
}

@media (max-width: 480px) {
    .changelog-toast {
        left: 16px;
        right: 16px;
        width: auto;
        bottom: 16px;
    }
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ==============================================
   FEEDBACK FAB
   ============================================== */

.feedback-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.feedback-fab:active {
    transform: scale(0.95);
}

/* Feedback Bottom Bar */
.feedback-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: auto;
    max-width: 100%;
    background: rgba(30, 30, 32, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-top-right-radius: 12px;
    z-index: 1000;
    padding: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.feedback-bar-content {
    padding: 14px 18px;
}

.feedback-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.feedback-bar-icon {
    font-size: 20px;
    flex: 0 0 auto;
}

.feedback-bar-input {
    flex: 1 1 260px;
    min-width: 160px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(28, 28, 30, 0.8);
    color: var(--text-primary);
    font-size: 17px;
    box-sizing: border-box;
    font-family: inherit;
}

.feedback-bar-input:focus {
    outline: none;
    border-color: var(--accent);
}

.feedback-bar-btn {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.feedback-bar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.feedback-bar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.feedback-submit-btn {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.feedback-submit-btn:hover:not(:disabled) {
    background: #0972db;
}

/* Type chip dropdown */
.feedback-type-chip {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.feedback-type-chip-arrow {
    font-size: 8px;
    color: var(--text-secondary);
}

.feedback-type-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 4px;
    background: rgba(44, 44, 46, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    min-width: 120px;
    z-index: 1001;
}

.feedback-type-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}

.feedback-type-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.feedback-type-option.active {
    background: rgba(10, 132, 255, 0.2);
}

/* Bug detail row */
.feedback-bar-details {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.feedback-bar-detail-row {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
}

.feedback-bar-detail-input {
    flex: 1 1 160px;
    min-width: 100px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(28, 28, 30, 0.6);
    color: var(--text-primary);
    font-size: 15px;
    box-sizing: border-box;
    font-family: inherit;
}

.feedback-bar-detail-input:focus {
    outline: none;
    border-color: var(--accent);
}

select.feedback-bar-detail-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238e8e93' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

/* Screenshots in bar */
.feedback-bar-screenshots {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Recording badge in bar */
.feedback-bar-recording-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 10px;
    background: rgba(52, 199, 89, 0.15);
    border: 1px solid rgba(52, 199, 89, 0.3);
    border-radius: 6px;
    color: #30D158;
    font-size: 12px;
}

.feedback-result {
    min-height: 0;
}

@media (max-width: 480px) {
    .feedback-fab {
        bottom: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .feedback-bar-detail-row {
        flex-wrap: wrap;
    }
}