/* ============================================
   INSTADM Components CSS
   Styles for reusable UI components
   ============================================ */

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-4);
}

.modal {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-xl);
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.2s ease;
}

.modal.modal-sm {
    max-width: 400px;
}

.modal.modal-lg {
    max-width: 700px;
}

.modal.modal-xl {
    max-width: 900px;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

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

.modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-5);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-3);
    padding: var(--spacing-4) var(--spacing-5);
    border-top: 1px solid var(--border-subtle);
    background: var(--surface-hover);
}

/* ============================================
   BADGE
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    padding: var(--spacing-1) var(--spacing-2);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-default {
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-success {
    background: var(--success-50);
    color: var(--success-600);
}

.badge-warning {
    background: var(--warning-50);
    color: var(--warning-600);
}

.badge-error {
    background: var(--error-50);
    color: var(--error-600);
}

.badge-info {
    background: var(--info-50);
    color: var(--info-600);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============================================
   AVATAR
   ============================================ */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-hover);
    font-weight: 600;
    color: var(--text-secondary);
}

.avatar-xs {
    width: 24px;
    height: 24px;
    font-size: var(--text-xs);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: var(--text-base);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--text-lg);
}

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

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

.avatar-placeholder {
    background: linear-gradient(135deg, var(--primary-300), var(--primary-500));
    color: white;
}

/* ============================================
   SPINNER
   ============================================ */

.spinner {
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-md {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.spinner-xl {
    width: 56px;
    height: 56px;
    border-width: 4px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Button spinner */
.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--spacing-16) var(--spacing-8);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-4);
    opacity: 0.7;
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-2);
    color: var(--text-primary);
}

.empty-state-description {
    color: var(--text-secondary);
    font-size: var(--text-base);
    margin-bottom: var(--spacing-6);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   STAT CARD - Enhanced Premium Design
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-5);
    margin-bottom: var(--spacing-6);
}

.stats-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.stats-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.stats-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

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

@media (min-width: 769px) and (max-width: 1024px) {

    .stats-grid.cols-3,
    .stats-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--spacing-5);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-4);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-200);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-400));
    opacity: 0;
    transition: opacity 0.2s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: var(--primary-50);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.stat-icon.warning {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

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

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

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: var(--spacing-1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    font-size: var(--text-xs);
    font-weight: 500;
    margin-top: var(--spacing-2);
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: var(--radius-full);
}

.stat-trend-up {
    background: var(--success-50);
    color: #16a34a;
}

.stat-trend-down {
    background: var(--error-50);
    color: #dc2626;
}

/* ============================================
   TABLE
   ============================================ */

.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th,
.table td {
    padding: var(--spacing-3) var(--spacing-4);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-hover);
}

.table tbody tr:hover {
    background: var(--surface-hover);
}

/* ============================================
   DROPDOWN
   ============================================ */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-2);
    z-index: 100;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: all var(--transition-fast);
}

.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

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

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

.tabs {
    display: flex;
    gap: var(--spacing-1);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--spacing-5);
}

.tab {
    padding: var(--spacing-3) var(--spacing-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ============================================
   FORM HELP TEXT
   ============================================ */

.form-help {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--spacing-1);
}

.has-error .form-input,
.has-error .form-select,
.has-error .form-textarea {
    border-color: var(--error);
}

.has-error .form-input:focus,
.has-error .form-select:focus,
.has-error .form-textarea:focus {
    box-shadow: 0 0 0 3px var(--error-50);
}

/* ============================================
   VISUALLY HIDDEN (Accessibility)
   ============================================ */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   PASSWORD VISIBILITY TOGGLE
   ============================================ */

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .form-input {
    padding-right: 48px;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: var(--spacing-2);
    cursor: pointer;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.password-toggle:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.password-toggle:focus {
    outline: none;
    color: var(--primary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Hide icon based on password visibility state */
.password-toggle .icon-eye-off {
    display: none;
}

.password-toggle.active .icon-eye {
    display: none;
}

.password-toggle.active .icon-eye-off {
    display: block;
}

/* ===================== */
/* Progress Bars (Usage Meters) */
/* ===================== */
.progress-bar {
    height: 8px;
    background: var(--surface-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light, var(--primary)));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* Color variants for usage levels */
.progress-fill.low {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.progress-fill.medium {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.progress-fill.high {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Usage meter component */
.usage-meter {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.usage-meter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.usage-meter-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.usage-meter-value {
    font-weight: 600;
    font-size: var(--text-sm);
}

.usage-meter-bar {
    height: 6px;
    background: var(--surface-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.usage-meter-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* ==========================================
   USAGE STRIP - Topbar Usage Bar
   ========================================== */

.usage-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-2) var(--spacing-4);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-size: var(--text-xs);
    transition: all 0.3s ease;
}

.usage-strip.hidden {
    display: none;
}

.usage-strip-content {
    display: flex;
    gap: var(--spacing-6);
    align-items: center;
    flex-wrap: wrap;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.usage-label {
    opacity: 0.9;
    font-weight: 500;
}

.usage-value {
    font-weight: 700;
}

.usage-bar-mini {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: white;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.usage-strip-toggle {
    background: transparent;
    border: none;
    color: white;
    opacity: 0.7;
    cursor: pointer;
    padding: var(--spacing-1);
    transition: opacity 0.2s;
}

.usage-strip-toggle:hover {
    opacity: 1;
}

.usage-strip-show {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 100;
    padding: var(--spacing-2);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0 0 0 var(--radius-md);
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.usage-strip-show:hover {
    opacity: 1;
}

.usage-strip-show.hidden {
    display: none;
}

/* Color variants based on usage level */
.usage-fill.low {
    background: #4ade80;
}

.usage-fill.medium {
    background: #fbbf24;
}

.usage-fill.high {
    background: #f87171;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    bottom: var(--spacing-6);
    right: var(--spacing-6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    pointer-events: none;
}

.toast {
    background: #1a1c23;
    color: #ffffff;
    padding: var(--spacing-4);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid var(--primary);
}

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--error);
}

.toast-warning {
    border-left-color: var(--warning);
}

.toast-info {
    border-left-color: var(--info);
}

.toast-message {
    font-size: var(--text-sm);
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--spacing-1);
    margin-left: var(--spacing-4);
    font-size: var(--text-xl);
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

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

/* ============================================
   HTMX INDICATORS
   ============================================ */

.htmx-indicator {
    display: none;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

/* ============================================
   SKELETON LOADERS
   ============================================ */

.skeleton {
    background: linear-gradient(90deg,
            var(--surface-hover) 0%,
            var(--bg-elevated, rgba(255, 255, 255, 0.1)) 50%,
            var(--surface-hover) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: var(--radius-sm);
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 70%;
}

.skeleton-text.full {
    width: 100%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

.skeleton-row {
    display: flex;
    gap: var(--spacing-3);
    align-items: center;
    padding: var(--spacing-3);
}

/* ============================================
   MICRO-ANIMATIONS
   ============================================ */

/* Card hover lift */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loading span {
    visibility: hidden;
}

/* Fade-in animation */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Pulse effect for notifications */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Scale on click */
.click-scale:active {
    transform: scale(0.96);
}

/* ============================================
   GLASS PANELS & CARDS (Premium UI)
   ============================================ */
.glass-panel {
    background: rgba(var(--bg-surface-rgb), 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all var(--transition-normal);
}

.glass-panel:hover {
    border-color: var(--border-default);
    background: rgba(var(--bg-surface-rgb), 0.85);
}

/* Glass Card (Interactive) */
.glass-card {
    background: rgba(var(--bg-elevated-rgb), 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-500);
}

/* Glass Header */
.glass-header {
    background: rgba(var(--bg-base-rgb), 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
}

/* ============================================
   WHITE GLASS DESIGN SYSTEM
   Extracted to: css/components/white-glass.css
   ============================================ */








.modal-white-glass input[type="url"],
.modal-white-glass input[type="number"],
.modal-white-glass input[type="email"],
.modal-white-glass input[type="password"],
.modal-white-glass input[type="datetime-local"],
.modal-white-glass textarea,
.modal-white-glass select,
.wg-input {
    width: 100%;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: #1e293b;
    font-size: 1rem;
    /* 16px prevents iOS auto-zoom */
    transition: all 0.2s ease;
}

.modal-white-glass input:focus,
.modal-white-glass textarea:focus,
.modal-white-glass select:focus,
.wg-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.modal-white-glass input::placeholder,
.modal-white-glass textarea::placeholder,
.wg-input::placeholder {
    color: #94a3b8;
}

/* White Glass Select Dropdown */
.modal-white-glass select,
.wg-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.modal-white-glass select option {
    background: #ffffff;
    color: #1e293b;
}

/* White Glass Labels */
.modal-white-glass label,
.wg-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 0.5rem;
    display: block;
}

/* White Glass Toggle Switch */
.wg-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.wg-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.wg-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: 0.3s;
    border: 2px solid #e2e8f0;
}

.wg-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: #ffffff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.wg-toggle input:checked+.wg-toggle-slider {
    background: #10b981;
    border-color: #059669;
}

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

/* White Glass Cards (Config Cards) */
.wg-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #1e293b;
}

.wg-card:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.wg-card.active {
    border-color: #10b981;
    background: #ecfdf5;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.wg-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.wg-card-icon.blue {
    background: #dbeafe;
    color: #2563eb;
}

.wg-card-icon.green {
    background: #dcfce7;
    color: #16a34a;
}

.wg-card-icon.purple {
    background: #f3e8ff;
    color: #9333ea;
}

.wg-card-icon.amber {
    background: #fef3c7;
    color: #d97706;
}

.wg-card-icon.red {
    background: #fee2e2;
    color: #dc2626;
}

.wg-card-icon.pink {
    background: #fce7f3;
    color: #db2777;
}

/* White Glass Action Cards (Dashed Border) */
.wg-action-card {
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
}

.wg-action-card:hover {
    border-color: #8b5cf6;
    background: #f5f3ff;
    color: #7c3aed;
}

.wg-action-card.active {
    border-style: solid;
    border-color: #10b981;
    background: #ecfdf5;
    color: #059669;
}

/* White Glass Buttons */
.wg-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.wg-btn-primary {
    background: linear-gradient(135deg, #10b981, #14b8a6);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.wg-btn-primary:hover {
    background: linear-gradient(135deg, #059669, #0d9488);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.wg-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.wg-btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.wg-btn-ghost {
    background: transparent;
    color: #64748b;
}

.wg-btn-ghost:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* White Glass Close Button */
.wg-close {
    width: 2.75rem;
    /* 44px touch target */
    height: 2.75rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: 0.75rem;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wg-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.wg-close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* White Glass Chip/Tag */
.wg-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.wg-chip.green {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.wg-chip.blue {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.wg-chip.purple {
    background: #f3e8ff;
    color: #6b21a8;
    border-color: #e9d5ff;
}

/* White Glass Progress Bar */
.wg-progress {
    height: 0.625rem;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.wg-progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.wg-progress-fill.green {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.wg-progress-fill.blue {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.wg-progress-fill.purple {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.wg-progress-fill.pink {
    background: linear-gradient(90deg, #ec4899, #f472b6);
}

/* White Glass Section Divider */
.wg-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 1.5rem 0;
}

/* White Glass Alert Box */
.wg-alert {
    padding: 1rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.wg-alert.info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.wg-alert.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.wg-alert.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.wg-alert.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* Text utilities for white glass context */
.wg-text-primary {
    color: #0f172a;
}

.wg-text-secondary {
    color: #475569;
}

.wg-text-muted {
    color: #94a3b8;
}

.wg-text-success {
    color: #16a34a;
}

.wg-text-warning {
    color: #d97706;
}

.wg-text-error {
    color: #dc2626;
}

/* Custom scrollbar for white glass modals */
.modal-white-glass ::-webkit-scrollbar {
    width: 6px;
}

.modal-white-glass ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.modal-white-glass ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.modal-white-glass ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   WHITE GLASS PROGRESS BARS
   ============================================ */
.wg-progress {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.wg-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.wg-progress-fill.purple {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.wg-progress-fill.pink {
    background: linear-gradient(90deg, #ec4899, #f472b6);
}

.wg-progress-fill.green {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.wg-progress-fill.blue {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.wg-progress-fill.orange {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* ============================================
   WHITE GLASS CHIPS/BADGES
   ============================================ */
.wg-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.wg-chip.green {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

.wg-chip.pink {
    background: #fdf2f8;
    color: #db2777;
    border-color: #fbcfe8;
}

.wg-chip.blue {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.wg-chip.purple {
    background: #f5f3ff;
    color: #7c3aed;
    border-color: #c4b5fd;
}

.wg-chip.amber {
    background: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

/* ============================================
   RESPONSIVE UTILITIES (Phase 2)
   Mobile-first responsive helpers
   ============================================ */

/* Modal Responsive - viewport-aware width */
.modal-responsive {
    width: calc(100vw - 2rem);
    max-width: 672px;
    /* Tailwind max-w-2xl */
}

.modal-responsive-lg {
    width: calc(100vw - 2rem);
    max-width: 512px;
    /* Tailwind max-w-lg */
}

/* Touch Target - Minimum 44px for accessibility */
.touch-target {
    min-width: 44px;
    min-height: 44px;
}

.touch-target-sm {
    min-width: 32px;
    min-height: 32px;
}

/* Mobile-safe text - 16px minimum to prevent zoom on iOS */
.mobile-text-safe {
    font-size: max(1rem, 16px);
}

/* Mobile padding helper */
.mobile-p {
    padding: 1rem;
}

@media (min-width: 768px) {
    .mobile-p {
        padding: 1.5rem;
    }
}

/* Z-index scale for modals */
.z-modal {
    z-index: 50;
}

.z-modal-overlay {
    z-index: 60;
}

.z-modal-high {
    z-index: 100;
}

.z-modal-critical {
    z-index: 300;
}

/* Safe area insets for mobile notch */
@supports (padding: env(safe-area-inset-top)) {
    .safe-area-top {
        padding-top: env(safe-area-inset-top);
    }

    .safe-area-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* No horizontal scroll utility */
.no-overflow-x {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Mobile-friendly modal body */
@media (max-width: 640px) {

    /* Modal takes full width on mobile */
    .white-glass-theme {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        border-radius: 1rem 1rem 0 0 !important;
        max-height: 95vh !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
    }

    .modal-white-glass-body {
        padding: 1rem !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }

    .modal-white-glass-header {
        padding: 1rem !important;
        gap: 0.75rem !important;
    }

    .modal-white-glass-header h3 {
        font-size: 1.125rem !important;
    }

    .modal-white-glass-header img,
    .modal-white-glass-header>div:first-child {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
    }

    .modal-white-glass-footer {
        padding: 1rem !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Stack footer buttons on mobile */
    .modal-white-glass-footer button {
        flex: 1;
        min-width: 100px;
        padding: 0.75rem 1rem !important;
    }

    /* Sequence builder mobile fixes */
    .sequence-builder {
        padding: 1rem !important;
    }

    .sequence-builder .builder-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .sequence-builder .action-buttons {
        justify-content: stretch !important;
    }

    .sequence-builder .action-buttons button {
        flex: 1 !important;
        justify-content: center !important;
    }

    .sequence-builder .step-card {
        padding: 1rem !important;
    }

    .sequence-builder .step-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .sequence-builder .step-controls {
        justify-content: space-between !important;
    }

    .sequence-builder .attach-btn {
        padding: 0.75rem 0.5rem !important;
    }

    .sequence-builder .attach-label {
        font-size: 0.6rem !important;
    }

    /* Response type cards - 2 columns on mobile */
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Chip sizes on mobile */
    .wg-chip {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.65rem !important;
    }
}