:root {
    --topbar-fixed-bg: rgba(2, 6, 23, 0.98);
    --topbar-fixed-bg-solid: rgba(2, 6, 23, 0.98);
    --topbar-fixed-border: rgba(20, 184, 166, 0.5);
    --topbar-fixed-text: #E5E7EB;
    --topbar-fixed-text-secondary: #CBD5E1;
    --topbar-fixed-text-muted: #9CA3AF;
    --topbar-fixed-btn-bg: rgba(255, 255, 255, .08);
    --topbar-fixed-btn-border: rgba(255, 255, 255, .15);
    --topbar-fixed-btn-bg-hover: rgba(255, 255, 255, .12);
    --topbar-fixed-btn-border-hover: rgba(255, 255, 255, .25);
    --wa-flow-avatar-bg: #e2e8f0;
    --wa-flow-avatar-text: #111b21;
    --topbar-fixed-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23E5E7EB' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");


    --color-primary: #008080;
    --color-primary-light: #14B8A6;
    --color-primary-dark: #0D9488;

    --color-secondary: #F59E0B;
    --color-secondary-dark: #D97706;

    --brand-dark: #052c24;
    --brand-teal: #107a74;
    --brand-accent: #a3ffef;

    --hero-bg: #083A3B;
    --hero-bg-dark: #062F30;
    --hero-bg-green: #2F6B2E;
    --white-bg: #ffffff;

    --link-color: #2DD4BF;
    --link-hover: #5EEAD4;

    --red-light: #ff5f56;
    --yellow-light: #ffbd2e; 
    --green-light: #27c93f;

    --danger-color: #ef4444;

    --radius-lg: 40px;
    --radius-md: 25px;
    --radius-sm: 15px;

    --block-gap: 12px;
    --screen-gap: 20px;

    --container-padding: 1.5rem;

    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.20);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.25);

    --gradient-primary: linear-gradient(65deg, #0F172A, #0D9488);
    --gradient-secondary: linear-gradient(135deg, #F59E0B, #D97706);
    --gradient-dark: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0.9),
        rgba(2, 6, 23, 1)
    );

    --ink: var(--contact-card-title, #1d1d1f);
    --paper: var(--white-bg, #ffffff);
    --paper-card: var(--contact-card-bg, #ffffff);
    --accent: var(--color-primary, #008080);
    --accent-bright: var(--color-primary-light, #14B8A6);
    --accent-wash: var(--color-success-bg, #dcfce7);
    --flag: var(--color-warning-light, #f59e0b);
    --flag-wash: var(--color-warning-bg, #fef3c7);
    --slate: var(--contact-card-count, #86868b);
    --slate-soft: var(--contact-row-subtext, #86868b);
    --line: var(--contact-card-border, #e5e5e7);
    --line-soft: rgba(0,0,0,0.05);

    --color-success: #16a34a;
    --color-success-light: #22c55e;
    --color-warning: #d97706;
    --color-warning-light: #f59e0b;
    --color-info: #3b82f6;
    --color-info-light: #60a5fa;
    
    /* Status Backgrounds for Light Theme */
    --color-success-bg: #dcfce7;
    --color-warning-bg: #fef3c7;
    --color-danger-bg: #fee2e2;
    --color-info-bg: #dbeafe;

    /* Public pricing page palette (intentionally independent of app theme mode). */
    --pricing-background: #F7FBF8;
    --pricing-page-tint: #E8F7F1;
    --pricing-surface: #FFFFFF;
    --pricing-surface-soft: #F1F8F5;
    --pricing-surface-highlight: #E7F7EF;
    --pricing-surface-warm: #FFF8E7;
    --pricing-border: #DCE7E3;
    --pricing-border-strong: #BFCFCA;
    --pricing-text: #102B29;
    --pricing-text-muted: #526663;
    --pricing-text-soft: #899692;
    --pricing-accent: #107A74;
    --pricing-success: #16A34A;
    --pricing-danger: #EF4444;
    --pricing-error: #A33131;
    --pricing-shadow-card: 0 14px 36px rgba(11, 47, 40, .07);
    --pricing-shadow-featured: 0 18px 40px rgba(0, 128, 128, .14);

    --builder-required-color: #ef4444;
    --builder-delete-color: #ef4444;

    --contact-card-bg: #ffffff;
    --contact-card-border: #e5e5e7;
    --contact-card-hover-border: #14B8A6;
    --contact-card-hover-shadow: 0 10px 30px rgba(20, 184, 166, 0.15);
    --contact-card-title: #1d1d1f;
    --contact-card-count: #86868b;
    
    /* Contact row styling - light theme */
    --contact-row-bg: #f5f5f7;
    --contact-row-border: #e5e5e7;
    --contact-row-hover-bg: #efefef;
    --contact-row-text: #1d1d1f;
    --contact-row-subtext: #86868b;
    
    /* Empty state - light theme */
    --contact-empty-bg: transparent;
    --contact-empty-title: #1d1d1f;
    --contact-empty-text: #86868b;
    
    /* Hints - light theme */
    --contact-hint-text: #555555;

    --mac-header-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);

    --wa-wallpaper-pattern: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg opacity='.18'%3E%3Cpath d='M0 28h220v1H0zm0 56h220v1H0zm0 56h220v1H0zm0 56h220v1H0z' fill='%23111827'/%3E%3Cpath d='M28 0h1v220h-1zm56 0h1v220h-1zm56 0h1v220h-1zm56 0h1v220h-1z' fill='%23111827'/%3E%3Ccircle cx='18' cy='18' r='3' fill='%23111827'/%3E%3Ccircle cx='110' cy='74' r='3' fill='%23111827'/%3E%3Ccircle cx='182' cy='162' r='3' fill='%23111827'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");

    --form-input-focus-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

[data-app-theme="dark"] {
    --color-background:   #0F172A;
    --color-surface:      #020617;
    --color-surface-alt:  #0B1120;

    --text-primary:       #E5E7EB;
    --text-secondary:     #CBD5E1;
    --text-muted:         #9CA3AF;
    --text-white:         #ffffff;
    --text-inverse:       #020617;
    --text-dark:          #E5E7EB;

    --phone-frame-bezel: #1f2937;

    --light-bg:           #0F172A;
    --light-dot:          rgba(20,184,166,.04);

    --border-color:       rgba(20, 184, 166, 0.5);

    --page-bg:            #0F172A;
    --card-bg:            #0B1120;
    --card-bg-hover:      #101A2E;
    --card-border:        rgba(20, 184, 166, 0.35);

    --input-bg-light:     rgba(255, 255, 255, 0.05);
    --input-border-light: rgba(20, 184, 166, 0.5);
    --input-shadow-light: 0 0 0 3px rgba(20, 184, 166, 0.15);

    --modal-bg-top:       #101A2E;
    --modal-bg-bottom:    #060B16;
    --modal-border:       rgba(20, 184, 166, 0.35);
    --modal-border-strong:rgba(20, 184, 166, 0.55);
    --modal-text:         #E7EBF0;
    --modal-text-secondary: #B7C1CC;
    --modal-text-muted:   #7D8A96;

    --modal-input-bg:        rgba(255, 255, 255, 0.03);
    --modal-input-bg-focus:  rgba(20, 184, 166, 0.08);
    --modal-input-border:    rgba(20, 184, 166, 0.35);
    --modal-input-shadow:    0 0 0 3px rgba(20, 184, 166, 0.15);

    --modal-shadow: 0 25px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(20, 184, 166, 0.08);
    --modal-glow:   0 0 24px rgba(20, 184, 166, 0.35);

    --input-shadow:           0 0 0 3px rgba(20, 184, 166, 0.1);
    --input-background:       rgba(255, 255, 255, 0.05);
    --input-background-focus: rgba(20, 184, 166, 0.05);

    --topbar-bg:        rgba(2, 6, 23, 0.95);
    --topbar-bg-solid:  rgba(2, 6, 23, 0.98);
    --topbar-btn-bg:        rgba(255, 255, 255, .08);
    --topbar-btn-border:    rgba(255, 255, 255, .15);
    --topbar-btn-bg-hover:  rgba(255, 255, 255, .12);
    --topbar-btn-border-hover: rgba(255, 255, 255, .25);

    --sidebar-surface:      rgba(20, 33, 47, 0.6);
    --sidebar-surface-alt:  rgba(15, 20, 25, 0.8);

    --hover-overlay:     rgba(255, 255, 255, 0.04);
    --bubble-in-bg:      #1F2C34;
    --bubble-in-text:    #E9EDEF;
    --modal-surface:     #101A2E;

    /* WhatsApp Flow preview - dark mode (matches native WA dark) */
    --wa-flow-header-bg: #0b141a;
    --wa-flow-header-text: #e9edef;
    --wa-flow-header-sub-text: #8696a0;
    --wa-flow-avatar-bg: #2a3942;
    --wa-flow-avatar-text: #e9edef;
    --wa-flow-body-bg: #0b141a;
    --wa-flow-text: #e9edef;
    --wa-flow-accent: #00a884;

    --option-row-bg: #2a2d35; 

    --bg-page:        #0F172A;
    --bg-toolbar:     rgba(11,17,32,.96);
    --bg-input:       rgba(255,255,255,.05);
    --bg-btn:         #0B1120;
    --dot-color:      rgba(20,184,166,.04);
    --canvas-bg:      #020617;

    --glass-bg:     rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg-hover: rgba(255, 255, 255, 0.07);

    --wa-list-hover-bg: rgba(20, 184, 166, 0.12);
    --wa-list-active-bg: rgba(20, 184, 166, 0.18);
    --wa-composer-glass-bg: rgba(15, 23, 42, 0.64);
    --wa-composer-glass-border: rgba(255, 255, 255, 0.08);
    --wa-scrollbar-thumb: rgba(148, 163, 184, 0.45);
    --wa-scrollbar-track: rgba(15, 23, 42, 0.25);
    --wa-bubble-in-bg: #1f2c34;
    --wa-bubble-out-bg: #005c4b;
    --wa-bubble-in-text: #e5e7eb;
    --wa-bubble-out-text: #f0fdf4;

    --wa-wallpaper-pattern: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.03)), url('/images/wallpaper-dark.jpeg');

    --status-approved-bg: rgba(16, 185, 129, 0.15);
    --status-approved-text: #10b981;
    --status-pending-bg: rgba(245, 158, 11, 0.15);
    --status-pending-text: #f59e0b;
    --status-rejected-bg: rgba(239, 68, 68, 0.15);
    --status-rejected-text: #f87171;
    --status-disabled-bg: rgba(107, 114, 128, 0.15);
    --status-disabled-text: #9ca3af;

    --phone-frame-bg:   #ffffff;
    --phone-bezel:      #1f1f1f;
    --phone-statusbar-bg: #ffffff;
    --phone-statusbar-text: #000000;

    --form-input-bg: rgba(255, 255, 255, 0.05);
    --form-input-border: rgba(20, 184, 166, 0.3);
    --form-input-focus-bg: rgba(20, 184, 166, 0.08);
    --form-input-focus-border: #14B8A6;
    --form-input-focus-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
    
    /* Info box styling - dark theme */
    --info-box-bg: rgba(20, 184, 166, 0.12);
    --info-box-border: rgba(20, 184, 166, 0.35);

    --builder-section-border: rgba(255, 255, 255, 0.05);
    
    /* Builder input styling - dark theme */
    --builder-input-bg: rgba(255, 255, 255, 0.05);
    --builder-input-border: rgba(20, 184, 166, 0.3);
    --builder-input-hover-border: #14B8A6;
    --builder-input-focus-border: #14B8A6;
    --builder-input-focus-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
    
    /* Builder upload styling - dark theme */
    --builder-upload-bg: rgba(255, 255, 255, 0.03);
    --builder-upload-border: rgba(20, 184, 166, 0.3);
    --builder-upload-hover-bg: rgba(20, 184, 166, 0.12);
    --builder-upload-hover-border: #14B8A6;
    
    /* Builder error styling - dark theme */
    --builder-error-bg: rgba(239, 68, 68, 0.15);
    --builder-error-border: rgba(239, 68, 68, 0.35);
    --builder-error-text: #f87171;
    
    /* Builder emoji picker - dark theme */
    --builder-picker-bg: rgba(255, 255, 255, 0.04);
    
    /* Builder params styling - dark theme */
    --builder-params-bg: rgba(255, 255, 255, 0.25);
    --builder-param-color: #14B8A6;
    
    /* Builder button row - dark theme */
    --builder-button-row-bg: rgba(255, 255, 255, 0.04);
    
    /* Builder delete button - dark theme */
    --builder-remove-hover-border: #ef4444;
    --builder-remove-hover-text: #ef4444;

    --contact-card-bg: rgba(255, 255, 255, 0.05);
    --contact-card-border: rgba(20, 184, 166, 0.3);
    --contact-card-hover-border: #14B8A6;
    --contact-card-hover-shadow: 0 10px 30px rgba(20, 184, 166, 0.2);
    --contact-card-title: #ffffff;
    --contact-card-count: #a0a0a0;
    
    /* Contact row styling - dark theme */
    --contact-row-bg: rgba(255, 255, 255, 0.03);
    --contact-row-border: rgba(20, 184, 166, 0.2);
    --contact-row-hover-bg: rgba(20, 184, 166, 0.1);
    --contact-row-text: #ffffff;
    --contact-row-subtext: #a0a0a0;
    
    /* Empty state - dark theme */
    --contact-empty-bg: transparent;
    --contact-empty-title: #ffffff;
    --contact-empty-text: #a0a0a0;
    
    /* Hints - dark theme */
    --contact-hint-text: #cccccc;

    --chevron-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23E5E7EB' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

[data-app-theme="light"] {
    --color-background:   #F4F6F8;
    --color-surface:      #ffffff;
    --color-surface-alt:  #F9FAFB;

    --text-primary:       #111827;
    --text-secondary:     #374151;
    --text-muted:         #6B7280;
    --text-white:         #ffffff;
    --text-inverse:       #ffffff;
    --text-dark:          #3d3d3d;

    --light-bg:           #F7F9F9;
    --light-dot:          #E7EFEE;

    --phone-frame-bezel: #F4F6F8;

    --border-color:       #dbe4ea;

    --option-row-bg: #f5f6f8;

    --page-bg:            #F4F6F8;
    --card-bg:            #FFFFFF;
    --card-bg-hover:      #FBFDFD;
    --card-border:        rgba(13, 148, 136, 0.35);

    --input-bg-light:     #F9FAFB;
    --input-border-light: #DCE3E8;
    --input-shadow-light: 0 0 0 3px rgba(13, 148, 136, 0.12);

    --modal-bg-top:       #FFFFFF;
    --modal-bg-bottom:    #F4F6F8;
    --modal-border:       rgba(13, 148, 136, 0.25);
    --modal-border-strong:rgba(13, 148, 136, 0.4);
    --modal-text:         #111827;
    --modal-text-secondary: #374151;
    --modal-text-muted:   #6B7280;

    --modal-input-bg:        #F9FAFB;
    --modal-input-bg-focus:  rgba(13, 148, 136, 0.06);
    --modal-input-border:    #DCE3E8;
    --modal-input-shadow:    0 0 0 3px rgba(13, 148, 136, 0.12);

    --modal-shadow: 0 25px 70px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(13, 148, 136, 0.06);
    --modal-glow:   0 0 24px rgba(13, 148, 136, 0.15);

    --input-shadow:           0 0 0 3px rgba(13, 148, 136, 0.1);
    --input-background:       #ffffff;
    --input-background-focus: rgba(13, 148, 136, 0.05);

    --topbar-bg:        rgba(255, 255, 255, 0.96);
    --topbar-bg-solid:  rgba(255, 255, 255, 0.98);
    --topbar-btn-bg:        rgba(0, 0, 0, .04);
    --topbar-btn-border:    rgba(0, 0, 0, .1);
    --topbar-btn-bg-hover:  rgba(0, 0, 0, .07);
    --topbar-btn-border-hover: rgba(0, 0, 0, .15);

    --sidebar-surface:      rgba(0, 0, 0, 0.025);
    --sidebar-surface-alt:  rgba(255, 255, 255, 0.7);

    --hover-overlay:     rgba(0, 0, 0, 0.03);
    --bubble-in-bg:      #ffffff;
    --bubble-in-text:    #111827;
    --modal-surface:     #ffffff;

    --bg-page:        #f8fafc;
    --bg-toolbar:     rgba(255,255,255,.96);
    --bg-input:       #ffffff;
    --bg-btn:         #ffffff;
    --dot-color:      rgba(0,128,128,.04);
    --canvas-bg:      #f8fafc;

    --glass-bg:     rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.09);
    --glass-bg-hover: rgba(0, 0, 0, 0.045);

    --wa-wallpaper-pattern: linear-gradient(135deg, rgba(15,23,42,0.22), rgba(15,23,42,0.08)), url('/images/wallpaper-whatsapp.jpg');

    --status-approved-bg: #dcfce7;
    --status-approved-text: #065f46;
    --status-pending-bg: #fef3c7;
    --status-pending-text: #92400e;
    --status-rejected-bg: #fee2e2;
    --status-rejected-text: #7f1d1d;
    --status-disabled-bg: #f3f4f6;
    --status-disabled-text: #374151;

    /* WhatsApp Flow preview - light mode (matches native WA light) */
    --wa-flow-header-bg: #ffffff;
    --wa-flow-header-text: #111b21;
    --wa-flow-header-sub-text: #667781;
    --wa-flow-avatar-bg: #e2e8f0;
    --wa-flow-avatar-text: #111b21;
    --wa-flow-body-bg: #ffffff;
    --wa-flow-text: #111b21;
    --wa-flow-accent: #008069;

    --phone-frame-bg:   #ffffff;
    --phone-bezel:      #1f1f1f;
    --phone-statusbar-bg: #ffffff;
    --phone-statusbar-text: #000000;

    --form-input-bg: #ffffff;
    --form-input-border: #e5e5e7;
    --form-input-focus-bg: #ffffff;
    --form-input-focus-border: #14B8A6;
    --form-input-focus-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
    
    /* Info box styling - light theme */
    --info-box-bg: rgba(20, 184, 166, 0.08);
    --info-box-border: rgba(20, 184, 166, 0.3);

    --builder-section-border: #f0f0f0;
    
    /* Builder input styling - light theme */
    --builder-input-bg: #ffffff;
    --builder-input-border: #e5e5e7;
    --builder-input-hover-border: #14B8A6;
    --builder-input-focus-border: #14B8A6;
    --builder-input-focus-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
    
    /* Builder upload styling - light theme */
    --builder-upload-bg: #f5f5f5;
    --builder-upload-border: #e5e5e7;
    --builder-upload-hover-bg: #f9fff6;
    --builder-upload-hover-border: #34C759;
    
    /* Builder error styling - light theme */
    --builder-error-bg: rgba(239, 68, 68, 0.1);
    --builder-error-border: rgba(239, 68, 68, 0.3);
    --builder-error-text: #dc2626;
    
    /* Builder emoji picker - light theme */
    --builder-picker-bg: #f8f8f8;
    
    /* Builder params styling - light theme */
    --builder-params-bg: #f5f5f5;
    --builder-param-color: #34C759;
    
    /* Builder button row - light theme */
    --builder-button-row-bg: #f9f9f9;
    
    /* Builder delete button - light theme */
    --builder-remove-hover-border: #ff3b30;
    --builder-remove-hover-text: #ff3b30;

    --chevron-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23374151' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");

}

/* Authentication Loading State */
.auth-loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-loading-container .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--color-primary-light, #14B8A6);
}

/* Not Found (404) State */
.not-found-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
    padding: 2rem;
}

.not-found-container .not-found-icon {
    font-size: 3rem;
    color: var(--color-primary-light, #14B8A6);
    margin-bottom: 1rem;
}

.not-found-container h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary, #1d1d1f);
}

.not-found-container p {
    color: var(--text-muted, #86868b);
    margin-bottom: 1.5rem;
    max-width: 420px;
}

.not-found-container .btn-primary {
    background: var(--color-primary, #008080);
    border-color: var(--color-primary, #008080);
}

html, body {
    font-family: 'Quicksand', sans-serif;
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
}

/* Keep application and form text on the single approved font. */
body,
button,
input,
select,
textarea,
code,
kbd,
pre,
samp,
.font-monospace {
    font-family: 'Quicksand', sans-serif !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Quicksand', sans-serif;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--red-light);
}

.validation-message {
    color: var(--red-light);
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

.validation-error {
    color: #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Loading Progress Bar */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-in-out;
}

.loading-progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.progress-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    width: 300px;
    height: 6px;
    background: rgba(20, 184, 166, 0.15);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(20, 184, 166, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 10px;
    animation: progressAnimation 1.5s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.5),
                0 0 30px rgba(20, 184, 166, 0.3);
}

.loading-text {
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 0.5px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes progressAnimation {
    0% {
        width: 0%;
        transform: translateX(0);
    }
    50% {
        width: 70%;
        transform: translateX(0);
    }
    100% {
        width: 100%;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* ============================================
   Modern Spinner Component
   ============================================ */

/* Spinner Overlay - Full screen loading */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    animation: fadeIn 0.2s ease-in-out;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Spinner Inline - Can be used anywhere */
.spinner-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

/* Base Spinner Styles */
.spinner {
    position: relative;
    display: inline-block;
}

/* Spinner Rings */
.spinner-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--color-primary-light);
    border-right-color: var(--color-primary-light);
}

.spinner-ring:nth-child(1) {
    animation: spinnerRotate 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-top-color: var(--color-primary-light);
    border-right-color: transparent;
}

.spinner-ring:nth-child(2) {
    animation: spinnerRotate 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    animation-delay: -0.5s;
    border-top-color: var(--color-primary);
    border-right-color: transparent;
}

.spinner-ring:nth-child(3) {
    animation: spinnerRotate 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    animation-delay: -1s;
    border-top-color: var(--color-primary-dark);
    border-right-color: transparent;
}

/* Small Spinner - 24px */
.spinner-small {
    width: 24px;
    height: 24px;
}

.spinner-small .spinner-ring {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

/* Medium Spinner - 40px (Default) */
.spinner-medium {
    width: 40px;
    height: 40px;
}

.spinner-medium .spinner-ring {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* Large Spinner - 64px */
.spinner-large {
    width: 64px;
    height: 64px;
}

.spinner-large .spinner-ring {
    width: 64px;
    height: 64px;
    border-width: 4px;
}

/* Spinner Text */
.spinner-text {
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 0.3px;
    margin: 0;
    animation: pulse 2s ease-in-out infinite;
}

.spinner-text-inline {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Spinner Animation */
@keyframes spinnerRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Table/Row Spinner Context */
.table-spinner-cell {
    text-align: center;
    padding: 1.5rem;
}

.row-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

/* Button Spinner (for inline buttons) */
.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    opacity: 0.7;
}

/* Centered Spinner for empty states */
.spinner-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: 1rem;
}

.spinner-center .spinner-text-inline {
    font-size: 1rem;
    color: var(--text-primary);
}

/* ============================================
   Tag Pills – shared across contacts/tags
   ============================================ */
.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--tag-color, #14B8A6) 18%, transparent);
    color: var(--tag-color, #14B8A6);
    border: 1px solid color-mix(in srgb, var(--tag-color, #14B8A6) 40%, transparent);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
    user-select: none;
    white-space: nowrap;
    line-height: 1.4;
}

.tag-pill:hover {
    background: color-mix(in srgb, var(--tag-color, #14B8A6) 28%, transparent);
    transform: translateY(-1px);
}

.tag-pill.active {
    background: color-mix(in srgb, var(--tag-color, #14B8A6) 35%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--tag-color, #14B8A6) 30%, transparent);
}

.tag-pill-all {
    --tag-color: #9CA3AF;
}

.tag-pill-sm {
    font-size: 0.72rem;
    padding: 0.15rem 0.6rem;
}

.tag-pill-remove {
    background: transparent;
    border: none;
    color: inherit;
    margin-left: 0.35rem;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
}

.tag-pill-remove:hover {
    opacity: 0.8;
}

/* ============================================
   Shared macOS-inspired form and button styles
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}

.btn-primary-mac,
.btn-secondary-mac,
.btn-ghost-mac,
.btn-danger-mac {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 10px;
    padding: 0.55rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-family: 'Quicksand', sans-serif;
    text-decoration: none;
}

.btn-primary-mac {
    background: var(--color-primary);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.24);
}

.btn-primary-mac:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn-secondary-mac {
    background: rgba(255,255,255,0.07);
    color: var(--color-primary-light);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(4px);
    
}

.btn-secondary-mac:hover:not(:disabled) {
    color: var(--color-primary);
    background: rgba(20,184,166,0.12);
    transform: translateY(-1px);
}

.btn-ghost-mac {
    background: transparent;
    color: var(--color-primary-light);
    border: 1px solid var(--border-color);
    transition: color 0.2s ease-in-out;
}

.btn-ghost-mac:hover {
    color: var(--color-primary);
}

.btn-danger-mac {
    background: var(--red-light);
    color: #fff;
    border: none;
}

.btn-danger-mac:hover:not(:disabled) {
    background: #e04040;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-primary-mac:disabled,
.btn-secondary-mac:disabled,
.btn-ghost-mac:disabled,
.btn-danger-mac:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

.icon-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }
.icon-btn.danger:hover { color: var(--red-light); background: rgba(255,95,86,0.1); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem 1.2rem;
}

.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }

/* Google Places address search used by the WhatsApp send location picker */
#send-message-location-search-element {
    display: block;
    width: 100%;
    min-height: 46px;
    box-sizing: border-box;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-background);
    color: var(--text-primary);
    color-scheme: light;
    font-family: 'Quicksand', sans-serif;
    font-size: 14px;
}

[data-app-theme="dark"] #send-message-location-search-element {
    color-scheme: dark;
}

#send-message-location-search-element::part(input) {
    color: var(--text-primary);
    font-family: 'Quicksand', sans-serif;
    font-size: 14px;
}

#send-message-location-search-element::part(input)::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

#send-message-location-search-element::part(focus-ring) {
    border-color: var(--color-primary-light);
    border-radius: 8px;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.mac-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.mac-input {
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 0.55rem 0.9rem;
    font-size: 0.875rem;
    font-family: 'Quicksand', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    width: 100%;
}

.mac-input:focus {
    border-color: var(--color-primary-light);
    box-shadow: var(--input-shadow);
    background: var(--input-background-focus);
}

.mac-input::placeholder { color: var(--text-muted); }

.mac-textarea {
    min-height: 80px;
    resize: vertical;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
select:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text-primary) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--input-background) inset !important;
    box-shadow: 0 0 0 1000px var(--input-background) inset !important;
    background: var(--input-background) !important;
    -webkit-background-clip: text !important;
    caret-color: var(--text-primary);

    /* delay the autofill background transition so it never visibly kicks in */
    transition: background-color 600000s 0s, color 600000s 0s !important;
    -webkit-transition: background-color 600000s ease-in-out 0s !important;
}

/* Firefox applies its autofill state to fields populated together as well. */
input:-moz-autofill,
input:-moz-autofill:hover,
input:-moz-autofill:focus,
textarea:-moz-autofill,
textarea:-moz-autofill:hover,
textarea:-moz-autofill:focus,
select:-moz-autofill,
select:-moz-autofill:hover,
select:-moz-autofill:focus {
    box-shadow: 0 0 0 1000px var(--input-background) inset !important;
    color: var(--text-primary) !important;
    caret-color: var(--text-primary);
}

.modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.validation-error {
    color: #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { color: var(--text-primary); margin-bottom: 0.5rem; }
.empty-state p { margin-bottom: 1.5rem; }

.confirm-body { text-align: center; padding: 1rem 0; }
.confirm-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.confirm-body p { color: var(--text-primary); margin: 0 0 0.4rem; }
.confirm-sub { color: var(--text-muted); font-size: 0.85rem; }

.color-picker-large {
    width: 100%;
    height: 42px;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.05);
}

