/**
 * Synclip Styles
 * Copy here. Paste there.
 */

/* ================================
   CSS Variables
   ================================ */
:root {
    /* Colors */
    --color-primary: #43AA8B;
    --color-primary-dark: #3a9479;
    --color-primary-light: #5dbf9f;
    
    --color-accent: #F8961E;
    --color-accent-dark: #e0860e;
    --color-accent-light: #f9a73e;
    
    /* Toast colors - strong */
    --color-success: #43AA8B;
    --color-warning: #F3722C;
    --color-danger: #F94144;
    --color-info: #177DA1;
    
    --color-secondary: #577590;
    --color-blue: #277DA1;
    
    /* Grays */
    --color-white: #FFFFFF;
    --color-gray-50: #F9FAFB;
    --color-gray-100: #F3F4F6;
    --color-gray-200: #E5E7EB;
    --color-gray-300: #D1D5DB;
    --color-gray-400: #9CA3AF;
    --color-gray-500: #6B7280;
    --color-gray-600: #4B5563;
    --color-gray-700: #374151;
    --color-gray-800: #1F2937;
    --color-gray-900: #111827;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
    --shadow-md: 0 4px 8px -1px rgb(0 0 0 / 0.12), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 20px -3px rgb(0 0 0 / 0.12), 0 4px 8px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 30px -5px rgb(0 0 0 / 0.14), 0 8px 12px -6px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Z-index layers */
    --z-dropdown: 100;
    --z-modal: 200;
    --z-toast: 9999; /* CHANGED from 300 */
    --z-splash: 10000;
}

/* ================================
   Reset & Base
   ================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--color-gray-800);
    background-color: var(--color-gray-100);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* ================================
   Screen Management
   ================================ */
.screen {
    min-height: 100vh;
    min-height: 100dvh;
}

.screen.hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* ================================
   Splash Screen
   ================================ */
.splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, #FFFFFF 0%, #FFFFFF 20%, #E8F5F1 60%, #E0F0F8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-splash);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
}

.splash-logo {
    width: auto;
    height: auto;
    max-width: 220px;
    max-height: 100px;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 30px;
    animation: pulse-logo 2s ease-in-out infinite;
    object-fit: contain;
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* 3-Dot Loader */
.splash-loader,
.dots-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.splash-loader::before,
.splash-loader::after,
.splash-loader span,
.dots-loader::before,
.dots-loader::after,
.dots-loader span {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.splash-loader::before,
.dots-loader::before {
    background: var(--color-primary);
    animation-delay: 0s;
}

.splash-loader span,
.dots-loader span {
    background: var(--color-accent);
    animation-delay: 0.2s;
}

.splash-loader::after,
.dots-loader::after {
    background: var(--color-info);
    animation-delay: 0.4s;
}

@keyframes dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Button dots loader */
.btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-loader::before,
.btn-loader::after,
.btn-loader span {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.btn-loader::before { animation-delay: 0s; }
.btn-loader span { display: block; animation-delay: 0.2s; }
.btn-loader::after { animation-delay: 0.4s; }

/* ================================
   Auth Screen - iOS Dynamic Island Fix
   ================================ */
#auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    touch-action: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: var(--space-3);
    /* Gradient from WHITE at top to colored at bottom */
    background: linear-gradient(180deg, 
        #FFFFFF 0%, 
        #FFFFFF 15%, 
        #F0FAF7 35%, 
        #E8F5F1 60%, 
        #E0F0F8 100%
    );
}

.auth-container {
    width: 100%;
    max-width: 380px;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
}

/* Fixed height logo container */
.logo-container {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    flex-shrink: 0;
}

.logo-wide {
    max-width: 240px;
    width: 100%;
    height: auto;
    max-height: 80px;
    object-fit: contain;
}

/* Auth Card - Solid white with clean shadow (no glass) */
.auth-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-gray-200);
}

.auth-section h2 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-gray-900);
    margin-bottom: var(--space-1);
    text-align: center;
}

.auth-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
    text-align: center;
    margin-bottom: var(--space-4);
}

/* ================================
   Input Styles - SINGLE border, no double line
   ================================ */
.code-input-container {
    margin-bottom: var(--space-3);
}

.code-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: 26px;
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', Monaco, monospace;
    text-align: center;
    letter-spacing: 0.4em;
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    outline: none;
    transition: all var(--transition-base);
    background: var(--color-white);
}

.code-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.1);
}

.code-input::placeholder {
    color: var(--color-gray-300);
    letter-spacing: 0.3em;
}

/* Text Input - SINGLE border */
.text-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
    font-family: inherit;
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    outline: none;
    margin-bottom: var(--space-3);
    transition: all var(--transition-base);
    background: var(--color-white);
}

.text-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.1);
}

/* Textarea - SINGLE border */
.clip-textarea {
    width: 100%;
    min-height: 100px;
    max-height: 200px; /* NEW: Increased from 180px */
    padding: var(--space-3);
    font-family: inherit;
    font-size: var(--font-size-base);
    line-height: 1.6;
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    resize: vertical;
    outline: none;
    transition: all var(--transition-base);
    background: var(--color-white);
    overflow-y: auto; /* NEW: Ensure scrolling */
}

.clip-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.1);
}

.clip-textarea::placeholder {
    color: var(--color-gray-400);
}

/* Auth Error */
.auth-error {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-white);
    padding: var(--space-3);
    background: var(--color-danger);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--space-4) 0;
    color: var(--color-gray-400);
    font-size: var(--font-size-sm);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-gray-200);
}

.auth-divider span {
    padding: 0 var(--space-3);
}

/* Clipboard Code Display */
.room-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

.room-code-display span {
    font-size: 28px;
    font-weight: 700;
    font-family: 'SF Mono', 'Menlo', Monaco, monospace;
    letter-spacing: 0.15em;
    color: var(--color-white);
}

.room-code-display .btn-icon {
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.2);
}

.room-code-display .btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

.room-code-hint {
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
    text-align: center;
    margin-bottom: var(--space-4);
}

/* Success Icon - SVG based, no emoji */
.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

/* Auth Footer */
.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    text-align: center;
}

/* ================================
   Toggle Switch (replaces checkbox)
   ================================ */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    padding: var(--space-2) 0;
}

.toggle-label {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--color-gray-300);
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-base);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.2);
}

/* Auth Success Message */
.auth-success {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-white);
    padding: var(--space-3);
    background: var(--color-success);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

/* ================================
   Buttons
   ================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    height: 48px;
    line-height: 1;
}

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn .btn-text {
    display: inline;
}

.btn-large {
    width: 100%;
    height: 48px;
    padding: 0 var(--space-5);
    font-size: var(--font-size-base);
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(248, 150, 30, 0.3);
}

.btn-primary:hover {
    background: var(--color-accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(248, 150, 30, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--color-gray-300);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    height: 48px;
    background: var(--color-white);
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-200);
}

.btn-secondary:hover {
    background: var(--color-gray-50);
    border-color: var(--color-gray-300);
}

.btn-secondary.btn-large {
    width: 100%;
}

.btn-file {
    cursor: pointer;
    flex-shrink: 0;
    width: auto;
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(249, 65, 68, 0.3);
}

.btn-danger:hover {
    background: #e03a3d;
    transform: translateY(-1px);
}

button.btn-text-link {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-gray-500);
    font-family: inherit;
    font-size: var(--font-size-sm);
    cursor: pointer;
    padding: 0;
    margin-top: var(--space-1);
}

button.btn-text-link:hover {
    color: var(--color-primary);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-900);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* ================================
   Header
   ================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    padding-top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--color-gray-200);
    background: var(--color-white);
    border-bottom: 1px solid var(--color-gray-200);
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
}

.header-logo-wide {
    height: 70px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    position: relative;
}

/* Sync Status */
.sync-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-success);
    background: rgba(67, 170, 139, 0.1);
    border-radius: var(--radius-full);
}

.sync-dot {
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sync-status.offline {
    color: var(--color-gray-500);
    background: var(--color-gray-100);
}

.sync-status.offline .sync-dot {
    background: var(--color-gray-400);
    animation: none;
}

/* Install Button */
.btn-install {
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
    height: 36px;
}

.btn-install:hover {
    background: var(--color-primary-dark);
}

.btn-install svg {
    width: 16px;
    height: 16px;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-gray-200);
    min-width: 180px;
    overflow: hidden;
    z-index: var(--z-dropdown);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    font-family: inherit;
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    cursor: pointer;
    transition: background var(--transition-fast);
    text-align: left;
}

.dropdown-item:hover {
    background: var(--color-gray-50);
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    color: var(--color-gray-500);
}

.room-info {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
    border-bottom: 1px solid var(--color-gray-100);
    cursor: default;
}

.room-info:hover {
    background: transparent;
}

/* ================================
   Main Content
   ================================ */
.main-content {
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    max-width: 800px;
    margin: 0 auto;
}

/* Input Section */
.input-section {
    margin-bottom: var(--space-4);
}

/* Input Card - Collapsible */
.input-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-gray-200);
    margin-top: 0;
    margin-bottom: var(--space-3);
    overflow: hidden;
}

.input-card-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--color-gray-500);
    cursor: pointer;
    transition: opacity 200ms ease, transform 200ms ease, color var(--transition-fast);
    transform-origin: top center;
}

.input-card-trigger:hover {
    color: var(--color-primary);
}

.input-card-trigger svg {
    flex-shrink: 0;
    color: var(--color-gray-400);
}

.input-card-trigger:hover svg {
    color: var(--color-primary);
}

.input-card-chevron {
    margin-left: auto;
}

.input-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 350ms cubic-bezier(0.4, 0, 0.2, 1), padding 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Staggered children: start hidden, pop in when expanded */
.input-card-body .textarea-wrapper,
.input-card-body .expiry-selector,
.input-card-body .input-actions {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 250ms ease, transform 250ms ease;
}

.input-card.expanded .input-card-trigger {
    opacity: 0;
    pointer-events: none;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    transition: opacity 150ms ease, height 200ms ease 100ms, padding 200ms ease 100ms;
}

.input-card.expanded .input-card-body {
    max-height: 600px;
    padding: var(--space-4);
}

.input-card.expanded .input-card-body .textarea-wrapper {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 100ms;
}

.input-card.expanded .input-card-body .expiry-selector {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 200ms;
}

.input-card.expanded .input-card-body .input-actions {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 300ms;
}

/* Edit Indicator */
.edit-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(67, 170, 139, 0.12);
    border: 1px solid rgba(67, 170, 139, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-primary);
}

.edit-indicator i {
    margin-right: 6px;
}

.btn-cancel-edit {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-cancel-edit:hover {
    background: rgba(0,0,0,0.05);
    color: var(--color-text);
}

[data-theme="dark"] .edit-indicator {
    background: rgba(67, 170, 139, 0.15);
    border-color: rgba(67, 170, 139, 0.25);
}

[data-theme="dark"] .btn-cancel-edit:hover {
    background: rgba(255,255,255,0.1);
    color: var(--color-text);
}

/* Attachment Preview in Input Card */
.attachment-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.attachment-header {
    width: 100%;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.attachment-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-gray-200);
    background: var(--color-gray-50);
    flex-shrink: 0;
}

.attachment-thumb img,
.attachment-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.attachment-thumb.attachment-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
}

.attachment-file-icon {
    font-size: 24px;
    color: var(--color-text-secondary);
}

.attachment-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    pointer-events: none;
}

.attachment-name {
    display: block;
    font-size: 10px;
    color: var(--color-text-secondary);
    text-align: center;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    position: absolute;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    color: white;
}

.attachment-file .attachment-name {
    position: relative;
    background: none;
    color: var(--color-text-secondary);
}

.remove-attachment {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background var(--transition-fast);
}

.remove-attachment:hover {
    background: rgba(220, 53, 69, 0.9);
}

[data-theme="dark"] .attachment-thumb {
    border-color: #3a3a3c;
    background: #2c2c2e;
}

/* Search Bar - Collapsible */
.search-bar {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--color-gray-200);
    margin-top: var(--space-2);
    margin-bottom: var(--space-4);
    overflow: hidden;
}

.search-bar-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--color-gray-400);
    cursor: pointer;
    transition: opacity 200ms ease, transform 200ms ease, color var(--transition-fast);
    transform-origin: top center;
}

.search-bar-trigger:hover {
    color: var(--color-primary);
}

.search-bar-trigger svg {
    flex-shrink: 0;
}

.search-bar-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 350ms cubic-bezier(0.4, 0, 0.2, 1), padding 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Staggered children for search bar */
.search-bar-body .search-input-wrapper,
.search-bar-body .search-filters {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 250ms ease, transform 250ms ease;
}

.search-bar.expanded .search-bar-trigger {
    opacity: 0;
    pointer-events: none;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    transition: opacity 150ms ease, height 200ms ease 100ms, padding 200ms ease 100ms;
}

.search-bar.expanded .search-bar-body {
    max-height: 200px;
    padding-top: var(--space-4);
}

.search-bar.expanded .search-bar-body .search-input-wrapper {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 100ms;
}

.search-bar.expanded .search-bar-body .search-filters {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 200ms;
}

.search-input-wrapper {
    position: relative;
    padding: 0 var(--space-4);
}

.search-input-icon {
    position: absolute;
    left: calc(var(--space-4) + 10px);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-gray-400);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: var(--space-2) var(--space-3) var(--space-2) 36px;
    border: 1.5px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-family: inherit;
    background: var(--color-gray-50);
    color: var(--color-gray-800);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.15);
    background: var(--color-white);
}

.search-input::placeholder {
    color: var(--color-gray-400);
}

.search-filters {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) var(--space-3);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.search-filters::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 4px 12px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: inherit;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-full);
    background: var(--color-white);
    color: var(--color-gray-600);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.filter-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-3);
    gap: var(--space-3);
}

/* Upload Progress */
.upload-progress {
    margin-top: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-200);
    animation: fadeIn 200ms ease;
}

.progress-bar {
    height: 8px;
    background: var(--color-gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-info) 100%);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 200ms ease;
}

.progress-text {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    font-weight: 500;
}

/* ================================
   Clips Section
   ================================ */
.clips-section {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-gray-200);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 350ms ease, transform 350ms ease;
}

.clips-section.ready {
    opacity: 1;
    transform: translateY(0);
}

.clips-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.clips-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-gray-800);
}

.clips-title svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
}

.clips-count {
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
    background: var(--color-gray-100);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* Category Filter Bar */
.category-bar {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.category-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-600);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.category-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.category-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.category-chip .cat-count {
    font-size: var(--font-size-xs);
    opacity: 0.7;
}

[data-theme="dark"] .category-chip {
    background: #2c2c2e;
    border-color: #48484a;
    color: #aeaeb2;
}

[data-theme="dark"] .category-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

[data-theme="dark"] .category-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Hidden clip (filtered out by search) */
.clip-hidden {
    display: none !important;
}

.clips-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Clip Item - Solid white */
.clip-item {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-gray-300);
    transition: box-shadow var(--transition-fast);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.clip-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-gray-300);
}

.clip-item.new {
    border-color: var(--color-primary);
    background: #F0FDFA;
}

.clip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.clip-type {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-600);
}

.clip-type.text { color: var(--color-info); }
.clip-type.file { color: var(--color-accent); }
.clip-type.image { color: var(--color-success); }

.clip-expiry {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

.clip-expiry.warning { color: var(--color-warning); }
.clip-expiry.danger { color: var(--color-danger); }

/* Clip Content */
.clip-content {
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-3);
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
}

/* File Preview */
.clip-file {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.clip-file:hover {
    background: var(--color-gray-100);
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--color-white);
    border-radius: var(--radius-md);
    color: var(--color-accent);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.file-icon svg {
    width: 22px;
    height: 22px;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

/* Image Preview */
.clip-image-preview {
    margin-bottom: var(--space-2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-gray-100);
    cursor: pointer;
    position: relative;
    min-height: 80px;
}

.clip-image-preview img {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: contain;
}

/* Image loading skeleton */
.clip-image-preview.loading {
    min-height: 120px;
}

.clip-image-preview.loading img {
    opacity: 0;
}

.clip-image-preview.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--color-gray-100) 25%, var(--color-gray-200) 50%, var(--color-gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.clip-image-preview:not(.loading) img {
    animation: fadeIn 200ms ease;
}

.thumb-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--color-gray-100) 25%, var(--color-gray-200) 50%, var(--color-gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    z-index: 1;
}

.gallery-thumb.loading img {
    opacity: 0;
}

.gallery-thumb:not(.loading) img {
    animation: fadeIn 200ms ease;
}

.gallery-thumb:not(.loading) .thumb-skeleton {
    display: none;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Gallery Card */
.gallery-grid {
    display: grid;
    gap: 4px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.gallery-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.gallery-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.gallery-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    background: var(--color-gray-100);
    position: relative;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 150ms ease;
}

.gallery-thumb:hover img {
    opacity: 0.85;
}

.gallery-thumb.gallery-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    gap: var(--space-1);
}

.gallery-thumb.gallery-file svg {
    width: 32px;
    height: 32px;
    color: var(--color-gray-400);
}

.gallery-thumb.gallery-file span {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.gallery-caption {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.clip-type.gallery {
    color: var(--color-accent);
}

/* Upload Preview Modal */
.upload-preview-modal {
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.upload-preview-modal .modal-body {
    padding: var(--space-4);
    flex: 1;
    overflow-y: auto;
}

.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.upload-preview-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-gray-100);
}

.upload-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-preview-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.upload-preview-file-icon svg {
    width: 40px;
    height: 40px;
    color: var(--color-gray-400);
}

.upload-preview-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 6px;
    font-size: 10px;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease;
}

.upload-preview-remove:hover {
    background: rgba(220, 38, 38, 0.8);
}

.upload-caption-field textarea {
    width: 100%;
    resize: none;
    font-size: var(--font-size-sm);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background: var(--color-white);
    color: var(--color-gray-900);
    font-family: inherit;
    transition: border-color 150ms ease;
}

.upload-caption-field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.15);
}

.upload-preview-modal .modal-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-gray-200);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

/* Clip Actions */
.clip-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-gray-100);
}

.clip-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--color-gray-100);
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clip-action:hover {
    transform: scale(1.05);
}

.clip-action.copy:hover {
    background: rgba(23, 125, 161, 0.15);
    color: var(--color-info);
}

.clip-action.download:hover {
    background: rgba(67, 170, 139, 0.15);
    color: var(--color-success);
}

.clip-action.delete:hover {
    background: rgba(249, 65, 68, 0.15);
    color: var(--color-danger);
}

.clip-action svg {
    width: 18px;
    height: 18px;
}

/* Empty State - SVG icon, no emoji */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--color-gray-500);
}

.empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-3);
    background: var(--color-gray-100);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon svg {
    width: 28px;
    height: 28px;
    color: var(--color-gray-400);
}

.empty-state h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-gray-700);
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: var(--font-size-sm);
}

/* Loading State - 3 dots */
.loading-state {
    text-align: center;
    padding: var(--space-6) var(--space-4);
}

.spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto var(--space-4);
}

.spinner::before,
.spinner::after,
.spinner span {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.spinner::before {
    background: var(--color-primary);
    animation-delay: 0s;
}

.spinner span {
    display: block;
    background: var(--color-accent);
    animation-delay: 0.2s;
}

.spinner::after {
    background: var(--color-info);
    animation-delay: 0.4s;
}

.loading-state p {
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
}

/* ================================
   Toast Notifications - Sexy glass style
   ================================ */
.toast-container {
    position: fixed;
    bottom: calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999; /* Explicit high value */
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: calc(100% - var(--space-8));
    max-width: 340px;
    pointer-events: none;
}

@media (max-width: 480px) {
    .toast-container {
        max-width: 280px;
        bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
    }
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    /* Glass effect for toast */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Toast colors with slight transparency for glass effect */
.toast.success { 
    background: rgba(67, 170, 139, 0.95);
    color: white;
}
.toast.error { 
    background: rgba(249, 65, 68, 0.95);
    color: white;
}
.toast.warning { 
    background: rgba(243, 114, 44, 0.95);
    color: white;
}
.toast.info {
    background: rgba(23, 125, 161, 0.95);
    color: white;
}

.toast-message {
    flex: 1;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.toast svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ================================
   Dialog / Modal
   ================================ */
.dialog-overlay {
    position: fixed;
    inset: 0;
    /* NO BLUR - Just dimmed overlay */
    background: rgba(0, 0, 0, 0.5);
    /* REMOVED: backdrop-filter and -webkit-backdrop-filter */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: var(--z-modal);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    width: 100%;
    max-width: 360px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.dialog h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-gray-900);
    margin-bottom: var(--space-2);
}

.dialog p {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
    margin-bottom: var(--space-5);
}

.dialog-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: stretch;
}

.dialog-actions .btn {
    flex: 1;
    width: auto;
}

/* ================================
   Modal Overlay - Gradient for iOS
   ================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    /* NO BLUR - Just dimmed */
    background: rgba(0, 0, 0, 0.5);
    /* REMOVED: backdrop-filter and -webkit-backdrop-filter */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
}

.sessions-modal {
    width: 90%;
    max-width: 380px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-gray-100);
}

.modal-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    color: var(--color-gray-800);
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-gray-500);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-800);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) var(--space-4);
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-device {
    font-size: var(--font-size-sm);
    color: var(--color-gray-800);
    margin-bottom: 2px;
}

.session-meta {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

.session-revoke {
    background: none;
    border: none;
    color: var(--color-gray-500);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    margin-left: 8px;
}

.session-revoke:hover {
    background: rgba(249, 65, 68, 0.1);
    color: var(--color-danger);
}

.modal-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-gray-100);
    display: flex;
    justify-content: center;
}

.no-sessions {
    text-align: center;
    color: var(--color-gray-500);
    padding: var(--space-4);
}

/* ================================
   Viewer Modals - Gradient bg for iOS
   ================================ */
.viewer-modal {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, 
        #FFFFFF 0%, 
        #FFFFFF 15%, 
        #F0FAF7 40%, 
        #E8F5F1 70%, 
        #E0F0F8 100%
    );
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
}

.viewer-modal.hidden {
    display: none;
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    padding-top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
    background: transparent;
}

.viewer-close,
.viewer-share {
    color: var(--color-gray-700);
    background: var(--color-white);
    box-shadow: var(--shadow-md);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.viewer-close:hover,
.viewer-share:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-900);
}

.viewer-title {
    color: var(--color-gray-800);
    font-size: var(--font-size-sm);
    font-weight: 600;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    overflow: auto;
}

.viewer-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.viewer-footer {
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    text-align: center;
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
}

/* File Viewer */
.file-viewer-content {
    flex-direction: column;
    text-align: center;
}

.file-viewer-icon {
    width: 80px;
    height: 80px;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-lg);
}

.file-viewer-icon svg {
    width: 40px;
    height: 40px;
    color: var(--color-accent);
}

.file-viewer-name {
    color: var(--color-gray-800);
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
    max-width: 280px;
    word-break: break-all;
}

.file-viewer-size {
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-5);
}

.file-viewer-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
    max-width: 260px;
}

.file-viewer-actions .btn {
    width: 100%;
    justify-content: center;
}

/* ================================
   App Screen Background
   ================================ */
#app-screen {
    background: linear-gradient(180deg, 
        #FFFFFF 0%, 
        #FFFFFF 10%, 
        #F0FAF7 30%, 
        #E8F5F1 60%, 
        #E0F0F8 100%
    );
    min-height: 100vh;
    min-height: 100dvh;
}

.header {
    background: var(--color-white);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

/* ================================
   iOS Install Prompt
   ================================ */
.ios-prompt {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.9) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.5) 100%
    );

    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: var(--z-modal);
}

.ios-prompt-content {
    background: var(--color-white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-5);
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 500px;
    text-align: center;
    position: relative;
}

.ios-prompt-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-gray-100);
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: var(--color-gray-600);
    cursor: pointer;
}

.ios-prompt-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

.ios-prompt h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.ios-prompt p {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

.ios-prompt-steps {
    margin-top: var(--space-3);
    text-align: left;
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
}

/* ================================
   Responsive
   ================================ */
@media (min-width: 768px) {
    .main-content {
        padding: var(--space-5);
    }

    .clip-textarea {
        min-height: 120px;
    }
    
    .logo-wide {
        max-width: 280px;
    }
    
    .code-input {
        font-size: 30px;
    }
    
    .auth-container {
        max-width: 420px;
    }
    

}
/* ================================
   Utilities - Fix focus-visible
   ================================ */
::selection {
    background: var(--color-primary);
    color: white;
}

/* Remove the default focus-visible outline, use glow instead */
:focus-visible {
    outline: none;
}

/* Specific focus styles for inputs with glow */
.code-input:focus,
.text-input:focus,
.clip-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.15);
    outline: none;
}

/* Focus for buttons */
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.3);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 2px 8px rgba(248, 150, 30, 0.3), 0 0 0 3px rgba(248, 150, 30, 0.2);
}

.btn-secondary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.2);
}

.btn-danger:focus-visible {
    outline: none;
    box-shadow: 0 2px 8px rgba(249, 65, 68, 0.3), 0 0 0 3px rgba(249, 65, 68, 0.2);
}

.btn-icon:focus-visible {
    outline: none;
    background: var(--color-gray-100);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.2);
}

/* Toggle switch focus */
.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.2);
}



/* ================================
   PHASE 2: Dark Mode - Pure Charcoal
   ================================ */

/* Dark mode CSS variables */
[data-theme="dark"] {
    --color-white: #1c1c1e;
    --color-gray-50: #121212;
    --color-gray-100: #1c1c1e;
    --color-gray-200: #38383a;
    --color-gray-300: #48484a;
    --color-gray-400: #636366;
    --color-gray-500: #8e8e93;
    --color-gray-600: #aeaeb2;
    --color-gray-700: #d1d1d6;
    --color-gray-800: #e5e5ea;
    --color-gray-900: #f2f2f7;
    
    color-scheme: dark;
}

/* Pure charcoal backgrounds - no green gradient */
[data-theme="dark"] body,
[data-theme="dark"] #auth-screen,
[data-theme="dark"] #app-screen,
[data-theme="dark"] .splash-screen,
[data-theme="dark"] .viewer-modal {
    background: #121212;
}

/* ================================
   Logo Invert (NO Glow) in Dark Mode
   ================================ */
[data-theme="dark"] .splash-logo,
[data-theme="dark"] .header-logo-wide,
[data-theme="dark"] .logo-wide,
[data-theme="dark"] .header-logo,
[data-theme="dark"] .ios-prompt-icon,
[data-theme="dark"] img[src*="logo"] {
    filter: invert(1) hue-rotate(180deg);
}

/* Splash screen logo - same (no extra glow now) */
[data-theme="dark"] .splash-logo {
    filter: invert(1) hue-rotate(180deg);
}

/* Hover effect on logos (no glow) */
[data-theme="dark"] .header-logo-wide:hover,
[data-theme="dark"] .logo-wide:hover {
    filter: invert(1) hue-rotate(180deg);
    transition: filter 0.3s ease;
}

/* ================================
   Dark Mode Components
   ================================ */
[data-theme="dark"] .header {
    background: #1c1c1e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .auth-card,
[data-theme="dark"] .input-card {
    background: #1c1c1e;
    border-color: #3a3a3c;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .input-card-trigger {
    color: #8e8e93;
}

[data-theme="dark"] .input-card-trigger:hover {
    color: var(--color-primary);
}

[data-theme="dark"] .input-card-trigger svg {
    color: #636366;
}

/* Search bar dark mode */
[data-theme="dark"] .search-bar {
    background: #1c1c1e;
    border-color: #3a3a3c;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .search-bar-trigger {
    color: #636366;
}

[data-theme="dark"] .search-bar-trigger:hover {
    color: var(--color-primary);
}

[data-theme="dark"] .search-input {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #e5e5ea;
}

[data-theme="dark"] .search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.2);
    background: #1c1c1e;
}

[data-theme="dark"] .search-input::placeholder {
    color: #636366;
}

[data-theme="dark"] .search-input-icon {
    color: #636366;
}

[data-theme="dark"] .filter-chip {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #aeaeb2;
}

[data-theme="dark"] .filter-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

[data-theme="dark"] .filter-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

[data-theme="dark"] .clip-item {
    background: #1c1c1e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .clip-item:hover {
    border-color: #48484a;
}

[data-theme="dark"] .clip-item.pinned {
    border-color: var(--color-accent);
}

[data-theme="dark"] .clip-content,
[data-theme="dark"] .clip-file {
    background: #2c2c2e;
}

[data-theme="dark"] .clip-actions {
    border-top-color: #3a3a3c;
}

[data-theme="dark"] .clip-file:hover {
    background: #3a3a3c;
}

[data-theme="dark"] .code-input,
[data-theme="dark"] .text-input,
[data-theme="dark"] .clip-textarea {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #e5e5ea;
}

[data-theme="dark"] .code-input:focus,
[data-theme="dark"] .text-input:focus,
[data-theme="dark"] .clip-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 170, 139, 0.2);
}

[data-theme="dark"] .code-input::placeholder,
[data-theme="dark"] .text-input::placeholder,
[data-theme="dark"] .clip-textarea::placeholder {
    color: #636366;
}

[data-theme="dark"] .btn-secondary {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #e5e5ea;
}

[data-theme="dark"] .btn-secondary:hover {
    background: #3a3a3c;
    border-color: #636366;
}

[data-theme="dark"] .dropdown-menu {
    background: #1c1c1e;
    border-color: #2c2c2e;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .dropdown-item {
    color: #e5e5ea;
}

[data-theme="dark"] .dropdown-item:hover {
    background: #2c2c2e;
}

[data-theme="dark"] .room-info {
    border-color: #2c2c2e;
    color: #aeaeb2;
}

[data-theme="dark"] .dialog {
    background: #1c1c1e;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .dialog h3 {
    color: #f2f2f7;
}

[data-theme="dark"] .dialog p {
    color: #aeaeb2;
}

[data-theme="dark"] .modal-content {
    background: #1c1c1e;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .modal-header {
    border-color: #2c2c2e;
}

[data-theme="dark"] .modal-header h3 {
    color: #f2f2f7;
}

[data-theme="dark"] .modal-footer {
    border-color: #2c2c2e;
}

[data-theme="dark"] .viewer-close,
[data-theme="dark"] .viewer-share {
    background: #2c2c2e;
    color: #e5e5ea;
}

[data-theme="dark"] .viewer-close:hover,
[data-theme="dark"] .viewer-share:hover {
    background: #3a3a3c;
}

[data-theme="dark"] .viewer-title {
    color: #e5e5ea;
}

[data-theme="dark"] .file-viewer-icon {
    background: #2c2c2e;
}

[data-theme="dark"] .file-viewer-name {
    color: #f2f2f7;
}

[data-theme="dark"] .dialog-overlay,
[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.75);
   }

[data-theme="dark"] .toggle-slider {
    background: #3a3a3c;
}

[data-theme="dark"] .session-item {
    background: #2c2c2e;
}

[data-theme="dark"] .session-device {
    color: #e5e5ea;
}

[data-theme="dark"] .clip-image-preview {
    background: #2c2c2e;
}

[data-theme="dark"] .clip-image-preview.loading::after,
[data-theme="dark"] .thumb-skeleton {
    background: linear-gradient(90deg, #2c2c2e 25%, #3a3a3c 50%, #2c2c2e 75%);
    background-size: 200% 100%;
}

[data-theme="dark"] .gallery-thumb {
    background: #2c2c2e;
}

[data-theme="dark"] .gallery-caption {
    color: #e5e5ea;
}

[data-theme="dark"] .gallery-thumb.gallery-file svg {
    color: #636366;
}

[data-theme="dark"] .gallery-thumb.gallery-file span {
    color: #8e8e93;
}

[data-theme="dark"] .clip-type.gallery {
    color: var(--color-accent-light);
}

[data-theme="dark"] .upload-preview-thumb {
    background: #2c2c2e;
}

[data-theme="dark"] .upload-caption-field textarea {
    background: #2c2c2e;
    border-color: #38383a;
    color: #e5e5ea;
}

[data-theme="dark"] .upload-preview-modal .modal-footer {
    border-top-color: #38383a;
}

[data-theme="dark"] .empty-state {
    color: #8e8e93;
}

[data-theme="dark"] .empty-state h3 {
    color: #d1d1d6;
}

[data-theme="dark"] .empty-icon {
    background: #2c2c2e;
}

[data-theme="dark"] .empty-icon svg {
    color: #636366;
}

[data-theme="dark"] .clips-title {
    color: #e5e5ea;
}

[data-theme="dark"] .clips-count {
    background: #2c2c2e;
    color: #aeaeb2;
}

[data-theme="dark"] .clip-type {
    color: #aeaeb2;
}

[data-theme="dark"] .clip-type.text { color: var(--color-info); }
[data-theme="dark"] .clip-type.file { color: var(--color-accent); }
[data-theme="dark"] .clip-type.image { color: var(--color-success); }

[data-theme="dark"] .clip-action {
    background: #2c2c2e;
    color: #aeaeb2;
}

[data-theme="dark"] .file-icon {
    background: #3a3a3c;
}

[data-theme="dark"] .file-name {
    color: #e5e5ea;
}

[data-theme="dark"] .file-size {
    color: #8e8e93;
}

[data-theme="dark"] .sync-status {
    background: rgba(67, 170, 139, 0.15);
}

[data-theme="dark"] .sync-status.offline {
    background: #2c2c2e;
}

[data-theme="dark"] .upload-progress {
    background: #2c2c2e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .progress-text {
    color: #e5e5ea;
}

[data-theme="dark"] .progress-bar {
    background: #3a3a3c;
}

[data-theme="dark"] .auth-subtitle {
    color: #8e8e93;
}

[data-theme="dark"] .auth-divider {
    color: #636366;
}

[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after {
    background: #3a3a3c;
}

[data-theme="dark"] .toggle-label {
    color: #aeaeb2;
}

[data-theme="dark"] .auth-footer {
    color: #636366;
}

[data-theme="dark"] .room-code-hint {
    color: #8e8e93;
}

[data-theme="dark"] button.btn-text-link {
    color: #8e8e93;
}

[data-theme="dark"] button.btn-text-link:hover {
    color: var(--color-primary);
}

[data-theme="dark"] .settings-section {
    border-color: #2c2c2e;
}

[data-theme="dark"] .settings-section h4 {
    color: #e5e5ea;
}

[data-theme="dark"] .ios-prompt-content {
    background: #1c1c1e;
}

[data-theme="dark"] .ios-prompt h3 {
    color: #f2f2f7;
}

[data-theme="dark"] .ios-prompt p {
    color: #aeaeb2;
}

[data-theme="dark"] .ios-prompt-steps {
    background: #2c2c2e;
}

[data-theme="dark"] .ios-prompt-close {
    background: #2c2c2e;
    color: #aeaeb2;
}

[data-theme="dark"] .edit-modal .modal-body {
    background: #1c1c1e;
}

[data-theme="dark"] .expiry-label {
    color: #8e8e93;
}

[data-theme="dark"] .expiry-option {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #aeaeb2;
}

[data-theme="dark"] .expiry-option:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

[data-theme="dark"] .expiry-option.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

[data-theme="dark"] #settings-expiry-options .expiry-option {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #aeaeb2;
}

[data-theme="dark"] #settings-expiry-options .expiry-option.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

[data-theme="dark"] .theme-option {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #aeaeb2;
}

[data-theme="dark"] .theme-option svg {
    color: #8e8e93;
}

[data-theme="dark"] .theme-option:hover {
    border-color: var(--color-primary);
}

[data-theme="dark"] .theme-option.active {
    border-color: var(--color-primary);
    background: rgba(67, 170, 139, 0.15);
}

[data-theme="dark"] .theme-option.active svg {
    color: var(--color-primary);
}

[data-theme="dark"] .theme-option span {
    color: #aeaeb2;
}

/* ================================
   Dark Mode Modal Glow Effect
   ================================ */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dialog,
[data-theme="dark"] .sessions-modal,
[data-theme="dark"] .settings-modal,
[data-theme="dark"] .edit-modal,
[data-theme="dark"] .share-modal,
[data-theme="dark"] .text-viewer-modal,
[data-theme="dark"] .pdf-viewer-modal {
    box-shadow: 
        0 0 0 1px rgba(67, 170, 139, 0.1),
        0 0 40px rgba(67, 170, 139, 0.15),
        0 0 80px rgba(67, 170, 139, 0.05),
        0 25px 60px rgba(0, 0, 0, 0.5);
}

/* Subtle glow for viewer modals in dark mode */
[data-theme="dark"] .viewer-modal .viewer-content img,
[data-theme="dark"] .file-viewer-icon {
    box-shadow: 0 0 30px rgba(67, 170, 139, 0.1);
}


/* ================================
   PHASE 2: Expiry Selector - Compact
   ================================ */
.expiry-selector {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.expiry-label {
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
    white-space: nowrap;
    min-width: fit-content;
}

.expiry-options {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.expiry-option {
    padding: 6px 10px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-full);
    background: var(--color-white);
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.expiry-option:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.expiry-option.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* ================================
   PHASE 2: Pinned Clips
   ================================ */
.clip-item.pinned {
    border-color: var(--color-accent);

}

.pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(248, 150, 30, 0.15);
    color: var(--color-accent);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-left: var(--space-2);
}

.pin-badge svg {
    width: 12px;
    height: 12px;
}

.clip-action.pin {
    color: var(--color-gray-500);
}

.clip-action.pin:hover {
    background: rgba(248, 150, 30, 0.15);
    color: var(--color-accent);
}

.clip-action.pin.active {
    color: var(--color-accent);
    background: rgba(248, 150, 30, 0.15);
}

/* Forever badge */
.clip-expiry.forever {
    color: var(--color-success);
}

.clip-expiry.forever svg {
    color: var(--color-success);
}

/* ================================
   PHASE 2: Edit Modal
   ================================ */
.edit-modal {
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.edit-modal .modal-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-gray-200);
}

.edit-modal .modal-body {
    padding: var(--space-4);
    flex: 1;
    overflow-y: auto;
}

.edit-modal .clip-textarea {
    min-height: 150px;
}

.edit-modal .modal-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-gray-200);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

/* ================================
   PHASE 2: Settings Modal
   ================================ */
.settings-modal {
    width: 90%;
    max-width: 400px;
}

.settings-section {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-gray-100);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-gray-800);
    margin-bottom: var(--space-3);
}

.theme-options {
    display: flex;
    gap: var(--space-2);
}

.theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    background: var(--color-white);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-option:hover {
    border-color: var(--color-primary);
}

.theme-option.active {
    border-color: var(--color-primary);
    background: rgba(67, 170, 139, 0.1);
}

.theme-option svg {
    width: 24px;
    height: 24px;
    color: var(--color-gray-500);
}

.theme-option.active svg {
    color: var(--color-primary);
}

.theme-option span {
    font-size: var(--font-size-xs);
    color: var(--color-gray-600);
}

/* ================================
   PHASE 2: Edit Button in Actions
   ================================ */
.clip-action.edit:hover {
    background: rgba(67, 170, 139, 0.15);
    color: var(--color-primary);
}




/* ========================================
   NEW: Edit modal textarea - Full scrolling
   ======================================== */

/* NEW: Edit textarea in modal */
.edit-textarea {
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
}

/* ========================================
   NEW: iOS install prompt - No blur
   CHANGE existing .ios-prompt
   ======================================== */

/* CHANGED: iOS Install Prompt - No blur */
.ios-prompt {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5); /* CHANGED: Solid dim, no gradient */
    /* REMOVED: backdrop-filter */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: var(--z-modal);
}

/* ========================================
   NEW: Phase 3 - Sharing Modal Styles
   ======================================== */

.share-modal {
    width: 90%;
    max-width: 400px;
}

.share-section {
    margin-bottom: var(--space-4);
}

.share-section label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: var(--space-2);
}

.share-expiry-options {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.share-note {
    min-height: 80px;
    resize: vertical;
}

.share-footer {
    display: flex;
    gap: var(--space-3);
}

.share-footer .btn {
    flex: 1;
}

/* Dark mode for share modal */
[data-theme="dark"] .share-section label {
    color: var(--color-gray-300);
}

/* ========================================
   NEW: Phase 4 - YouTube Embed Styles
   ======================================== */

.youtube-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
    background: var(--color-gray-900);
}

.youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-lg);
}

/* ========================================
   NEW: Phase 4 - Code Block Styles
   ======================================== */

.code-block {
    position: relative;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #1e1e1e;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
}

.code-language {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-copy-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px 8px;
    background: #3d3d3d;
    border: none;
    border-radius: var(--radius-sm);
    color: #ccc;
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.code-copy-btn:hover {
    background: #4d4d4d;
    color: white;
}

.code-block pre {
    margin: 0;
    padding: var(--space-3);
    overflow-x: auto;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.code-block code {
    font-family: 'SF Mono', 'Fira Code', 'Monaco', monospace;
    color: #d4d4d4;
}

/* Prism.js theme overrides */
.code-block .token.comment { color: #6a9955; }
.code-block .token.string { color: #ce9178; }
.code-block .token.number { color: #b5cea8; }
.code-block .token.keyword { color: #569cd6; }
.code-block .token.function { color: #dcdcaa; }
.code-block .token.operator { color: #d4d4d4; }
.code-block .token.punctuation { color: #808080; }
.code-block .token.class-name { color: #4ec9b0; }
.code-block .token.property { color: #9cdcfe; }

/* ========================================
   NEW: Phase 4 - Audio Player Styles
   ======================================== */

.clip-audio {
    padding: var(--space-3);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
}

.clip-audio audio {
    width: 100%;
    height: 40px;
    outline: none;
}

.audio-transcription {
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    background: var(--color-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-gray-200);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 120px;
    overflow-y: auto;
}

[data-theme="dark"] .audio-transcription {
    background: #1c1c1e;
    border-color: #3a3a3c;
    color: #e5e5ea;
}

.audio-filename {
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    text-align: center;
}

/* Dark mode audio */
[data-theme="dark"] .clip-audio {
    background: #2c2c2e;
}

[data-theme="dark"] .clip-audio audio {
    filter: invert(1) hue-rotate(180deg);
}

/* ========================================
   Video Player Styles
   ======================================== */

.clip-video {
    margin-bottom: var(--space-2);
}

.clip-video video {
    width: 100%;
    max-height: 400px;
    border-radius: var(--radius-lg);
    background: #000;
    outline: none;
}

.video-filename {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
    text-align: center;
}

/* ========================================
   NEW: Clip type audio badge
   ======================================== */

.clip-type.audio {
    color: #9b59b6;
}

.clip-type.video {
    color: #e74c3c;
}

/* ========================================
   NEW: Share action button styles
   ======================================== */

.clip-action.share:hover {
    background: rgba(67, 170, 139, 0.15);
    color: var(--color-primary);
}

/* ========================================
   DARK MODE ADDITIONS
   Add these to the dark mode section
   ======================================== */

[data-theme="dark"] .code-block {
    background: #1a1a1a;
}

[data-theme="dark"] .code-header {
    background: #252525;
    border-color: #333;
}

[data-theme="dark"] .youtube-embed {
    background: #000;
}



@media (max-width: 768px) {
  .header-logo-wide {
    height: 70px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    display: block;
  }
}




/* ========================================
   FIX #1: Share Modal Input Width Fix
   ======================================== */

.share-modal {
    width: 90%;
    max-width: 400px;
}

.share-modal .modal-body {
    padding: var(--space-4);
}

.share-section {
    margin-bottom: var(--space-4);
}

.share-section label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: var(--space-2);
}

/* FIX: Constrain share modal inputs */
.share-input,
.share-note {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.share-note {
    min-height: 80px;
    resize: vertical;
}

.share-expiry-options {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.share-footer {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--color-gray-100);
}

.share-footer .btn {
    flex: 1;
}

/* ========================================
   FIX #4: Dark Mode Logo - No Filter
   ======================================== */

/* Remove the filter-based logo inversion */
[data-theme="dark"] .splash-logo,
[data-theme="dark"] .header-logo-wide,
[data-theme="dark"] .logo-wide,
[data-theme="dark"] .header-logo,
[data-theme="dark"] img[src*="logo"] {
    filter: none; /* Let JS handle the src swap */
}

/* ========================================
   FIX #7: Text Viewer Modal
   ======================================== */

.text-viewer-modal {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.text-viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.text-viewer-content {
    font-size: var(--font-size-sm);
    line-height: 1.7;
    color: var(--color-gray-700);
    white-space: pre-wrap;
    word-break: break-word;
}

[data-theme="dark"] .text-viewer-content {
    color: var(--color-gray-300);
}

/* Clickable text indicator */
.clip-content-clickable {
    cursor: pointer;
    position: relative;
}

.clip-content-clickable:hover {
    background: var(--color-gray-100);
}

[data-theme="dark"] .clip-content-clickable:hover {
    background: var(--color-gray-200);
}

.click-to-expand {
    display: block;
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px dashed var(--color-gray-300);
    font-size: var(--font-size-xs);
    color: var(--color-primary);
    font-weight: 500;
}

/* ========================================
   FIX #10: Video clip type
   ======================================== */

.clip-type.video { 
    color: #e74c3c; 
}

.clip-type.code {
    color: #9b59b6;
}

/* ========================================
   FIX #11: PDF Preview Styles
   ======================================== */

.clip-pdf-preview {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.clip-pdf-preview:hover {
    background: var(--color-gray-100);
}

[data-theme="dark"] .clip-pdf-preview {
    background: #2c2c2e;
}

[data-theme="dark"] .clip-pdf-preview:hover {
    background: #3a3a3c;
}

.pdf-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e74c3c;
    border-radius: var(--radius-md);
    color: white;
}

.pdf-icon svg {
    width: 28px;
    height: 28px;
}

.pdf-info {
    flex: 1;
}

.pdf-name {
    font-weight: 500;
    color: var(--color-gray-800);
}

.pdf-size {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

.pdf-preview-hint {
    font-size: var(--font-size-xs);
    color: var(--color-primary);
}

.clip-type.pdf {
    color: #e74c3c;
}

/* PDF Viewer Modal */
.pdf-viewer-modal {
    width: 95%;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.pdf-viewer-body {
    flex: 1;
    overflow: hidden;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--color-gray-100);
}

[data-theme="dark"] .pdf-iframe {
    background: #2c2c2e;
}

/* Dark mode share section */
[data-theme="dark"] .share-section label {
    color: var(--color-gray-300);
}

[data-theme="dark"] .share-footer {
    border-color: #2c2c2e;
}

/* Fix text indent in clip content */
.clip-text {
    text-indent: 0 !important;
    margin: 0;
    padding: 0;
}

.clip-text-content {
    text-indent: 0 !important;
    white-space: pre-wrap;
    word-break: break-word;
}

.clip-preview {
    text-indent: 0 !important;
}



/* Email Autocomplete */
.email-autocomplete-wrapper {
    position: relative;
}

/* Share modal body — scrollable, email suggestions use fixed positioning */
.share-modal-body {
    overflow-y: auto;
    overflow-x: hidden;
}

.email-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); /* Stronger shadow to pop */
    z-index: 999999 !important; /* Ensure it is above everything in the modal */
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

[data-theme="dark"] .email-suggestions {
    background: #2c2c2e;
    border-color: #3a3a3c;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}


.email-suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    transition: background var(--transition-fast);
}

.email-suggestion:hover {
    background: var(--color-gray-50);
}

.email-suggestion svg {
    color: var(--color-gray-400);
    flex-shrink: 0;
}

/* Dark mode */
[data-theme="dark"] .email-suggestions {
    background: #1c1c1e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .email-suggestion {
    color: #e5e5ea;
}

[data-theme="dark"] .email-suggestion:hover {
    background: #2c2c2e;
}


/* Text Viewer Modal - Dark Mode Fix */
.text-viewer-content {
    color: var(--color-gray-700);
}

[data-theme="dark"] .text-viewer-content {
    color: #e5e5ea;
}

[data-theme="dark"] .text-viewer-body {
    background: #2c2c2e;
}


/* PDF Viewer */
.pdf-viewer-modal {
    width: 90%;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.pdf-viewer-body {
    flex: 1;
    min-height: 0;
    background: var(--color-gray-100);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.pdf-object {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-gray-500);
}

[data-theme="dark"] .pdf-viewer-body {
    background: #2c2c2e;
}

/* Prevent layout shift from scrollbar appearing */
html {
    overflow-y: scroll; /* Always show scrollbar track */
}

/* Smooth splash screen transition */
.splash-screen {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Ensure app screen fades in smoothly */
.screen {
    transition: opacity 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

#app-screen {
    opacity: 0;
    transition: opacity 0.3s ease 0.1s; /* slight delay after splash fades */
}

#app-screen:not(.hidden) {
    opacity: 1;
}

/* PDF Viewer Modal */
.pdf-viewer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.pdf-preview-container {
    width: 100%;
    height: 60vh;
    max-height: 500px;
    background: var(--color-gray-100);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: none;
}

.pdf-preview-container.active {
    display: block;
}

.pdf-preview-container embed,
.pdf-preview-container object {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-file-card {
    padding: 40px 20px;
}

.pdf-file-card.hidden {
    display: none;
}

.pdf-file-icon {
    color: var(--color-accent);
    margin-bottom: 16px;
}

.pdf-file-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-gray-800);
    word-break: break-word;
    margin-bottom: 8px;
}

.pdf-file-size {
    font-size: 14px;
    color: var(--color-gray-500);
}

.pdf-viewer-footer {
    padding: 16px 20px !important;
    display: flex;
    justify-content: center;
}

.pdf-viewer-footer .btn {
    min-width: 200px;
}

[data-theme="dark"] .pdf-preview-container {
    background: #2c2c2e;
}

[data-theme="dark"] .pdf-file-name {
    color: #e5e5ea;
}

[data-theme="dark"] .pdf-file-icon {
    color: var(--color-accent);
}


/* PDF clip card in list */
.clip-pdf-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.clip-pdf-preview:hover {
    background: var(--color-gray-100);
}

.pdf-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    flex-shrink: 0;
}

.pdf-info {
    flex: 1;
    min-width: 0;
}

.pdf-name {
    font-weight: 500;
    color: var(--color-gray-800);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-size {
    font-size: 12px;
    color: var(--color-gray-500);
    margin-top: 2px;
}

.pdf-preview-hint {
    font-size: 11px;
    color: var(--color-gray-400);
    white-space: nowrap;
}

[data-theme="dark"] .clip-pdf-preview {
    background: #2c2c2e;
}

[data-theme="dark"] .clip-pdf-preview:hover {
    background: #3a3a3c;
}

[data-theme="dark"] .pdf-name {
    color: #e5e5ea;
}

/* PDF Viewer Modal - file card only */
.pdf-viewer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    flex: 1;
}

.pdf-file-card {
    padding: 20px;
}

.pdf-file-icon {
    color: var(--color-accent);
    margin-bottom: 20px;
}

.pdf-file-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-gray-800);
    word-break: break-word;
    margin-bottom: 8px;
    max-width: 280px;
}

.pdf-file-size {
    font-size: 14px;
    color: var(--color-gray-500);
}

.pdf-viewer-footer {
    padding: 20px !important;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--color-gray-200);
}

.pdf-viewer-footer .btn {
    min-width: 200px;
}

[data-theme="dark"] .pdf-file-name {
    color: #e5e5ea;
}

[data-theme="dark"] .pdf-viewer-footer {
    border-top-color: #3a3a3c;
}


/* ================================
   Clip Update Flash Animation
   ================================ */
@keyframes clipUpdateFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(67, 170, 139, 0.4);
        border-color: var(--color-primary);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(67, 170, 139, 0.2);
        border-color: var(--color-primary);
    }
    100% {
        box-shadow: none;
        border-color: var(--color-gray-200);
    }
}

.clip-item.clip-updated {
    animation: clipUpdateFlash 1.5s ease-out;
    border-color: var(--color-primary);
}

[data-theme="dark"] .clip-item.clip-updated {
    animation: clipUpdateFlash 1.5s ease-out;
}

[data-theme="dark"] @keyframes clipUpdateFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(67, 170, 139, 0.5);
        border-color: var(--color-primary);
    }
    50% {
        box-shadow: 0 0 25px 8px rgba(67, 170, 139, 0.3);
        border-color: var(--color-primary);
    }
    100% {
        box-shadow: none;
        border-color: #2c2c2e;
    }
}



/* ================================
   Login Page - Taller Screen Adjustments
   ================================ */

/* Mobile auth screen positioning */
#auth-screen {
    justify-content: flex-start;
    padding-top: max(env(safe-area-inset-top), 20px);
}

/* Push content down on taller screens */
@media (min-height: 700px) {
    #auth-screen {
        padding-top: calc(max(env(safe-area-inset-top), 20px) + 40px);
    }
}

@media (min-height: 800px) {
    #auth-screen {
        padding-top: calc(max(env(safe-area-inset-top), 20px) + 60px);
    }
}

@media (min-height: 900px) {
    #auth-screen {
        padding-top: calc(max(env(safe-area-inset-top), 20px) + 80px);
    }
}

/* Keep auth card position fixed when switching sections */
.auth-container {
    width: 100%;
    max-width: 380px;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
}

/* Fixed height for auth card area to prevent jumping */
.auth-card {
    min-height: 380px; /* Adjust based on your largest card */
}

/* Specific section heights to prevent jumping */
#join-section,
#create-section,
#recovery-section,
#success-section {
    display: flex;
    flex-direction: column;
}

#join-section.hidden,
#create-section.hidden,
#recovery-section.hidden,
#success-section.hidden {
    display: none !important;
}


/* ================================
   Share Badge on Clips
   ================================ */
.share-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(67, 170, 139, 0.15);
    color: var(--color-primary);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-left: var(--space-2);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-badge:hover {
    background: rgba(67, 170, 139, 0.25);
}

.share-badge svg {
    width: 12px;
    height: 12px;
}

/* Share info modal items */
.share-info-item {
    padding: var(--space-3);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
}

.share-info-recipient {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-800);
    margin-bottom: 4px;
}

.share-info-meta {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

[data-theme="dark"] .share-info-item {
    background: #2c2c2e;
}

[data-theme="dark"] .share-info-recipient {
    color: #e5e5ea;
}

.no-shares {
    text-align: center;
    color: var(--color-gray-500);
    padding: var(--space-4);
    font-size: var(--font-size-sm);
}


/* ================================
   Modal Fixes - Height & Judder
   ================================ */

/* Prevent scrollbar layout shift on desktop */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

/* Modal overlay - allow scrolling for tall modals */
.modal-overlay {
    overflow-y: auto;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    align-items: flex-start; /* Changed from center - prevents top cutoff */
    justify-content: center;
}

/* Modal content - proper height constraints */
.modal-content {
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    margin: auto 0; /* Center vertically with flex-start */
    flex-shrink: 0;
}

/* Sessions modal - scrollable list */
.sessions-modal {
    max-height: min(80vh, 600px);
    max-height: min(80dvh, 600px);
}

.sessions-list {
    max-height: 50vh;
    max-height: 50dvh;
    overflow-y: auto;
}

/* Settings modal - scrollable if needed */
.settings-modal {
    max-height: min(85vh, 500px);
    max-height: min(85dvh, 500px);
    overflow-y: auto;
}

/* Dialog overlay - same fix */
.dialog-overlay {
    overflow-y: auto;
    align-items: flex-start;
    padding-top: max(20px, env(safe-area-inset-top));
}

.dialog {
    margin: auto 0;
}

/* ================================
   QR Code in Share Modal
   ================================ */
.share-qr-section {
    text-align: center;
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
}

.share-qr-container {
    display: inline-block;
    padding: 8px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.share-qr-hint {
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

[data-theme="dark"] .share-qr-section {
    background: #2c2c2e;
}

[data-theme="dark"] .share-qr-container {
    background: white;
}

/* ================================
   Expiry Toggle (Clickable)
   ================================ */
.expiry-toggle {
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: var(--radius-md);
}

.expiry-toggle:hover {
    background: var(--color-gray-100);
}

[data-theme="dark"] .expiry-toggle:hover {
    background: #2c2c2e;
}

/* ================================
   Paste Button
   ================================ */
.btn-paste {
    flex-shrink: 0;
}

/* On iOS, make paste button more prominent */
@supports (-webkit-touch-callout: none) {
    .btn-paste {
        background: var(--color-primary);
        color: white;
        border-color: var(--color-primary);
    }
    
    .btn-paste:hover {
        background: var(--color-primary-dark);
    }
}

/* ================================
   Input Actions - 3 buttons layout
   ================================ */
.input-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.input-actions .btn {
    flex: 1;
    min-width: 0;
    padding: var(--space-2) var(--space-3);
}

.input-actions .btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Hide text on small screens */
@media (max-width: 400px) {
    .input-actions .btn-paste span:not(.btn-loader),
    .input-actions .btn-file span:not(svg) {
        display: none;
    }
    
    .input-actions .btn {
        padding: var(--space-2);
    }
}


/* Desktop paste button - positioned in textarea corner */
.input-card {
    position: relative;
}

.paste-btn-desktop {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: 70px; /* Above the action buttons */
    right: 20px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--color-gray-100);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    color: var(--color-gray-500);
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 5;
    align-items: center;
    justify-content: center;
}

.paste-btn-desktop:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Show only on desktop */
@media (min-width: 768px) and (hover: hover) {
    .paste-btn-desktop {
        display: flex;
    }
}

[data-theme="dark"] .paste-btn-desktop {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #8e8e93;
}

[data-theme="dark"] .paste-btn-desktop:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* QR section loading */
.qr-loading {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-gray-100);
    border-radius: 8px;
}

[data-theme="dark"] .qr-loading {
    background: #2c2c2e;
}

.btn-small {
    height: 36px;
    padding: 0 12px;
    font-size: var(--font-size-xs);
}


/* Add to style.css */

/* Copy image button hover effect */
.clip-action.copy-image:hover {
    background: rgba(23, 125, 161, 0.15);
    color: var(--color-info);
}

/* ================================
   Share Modal - Fixed sizing & positioning
   ================================ */
.share-modal {
    width: 90%;
    max-width: 400px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    margin: 20px auto;
}

.share-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    -webkit-overflow-scrolling: touch;
}

.share-modal .modal-footer {
    flex-shrink: 0;
    padding: var(--space-4);
    border-top: 1px solid var(--color-gray-100);
}

[data-theme="dark"] .share-modal .modal-footer {
    border-top-color: #2c2c2e;
}

/* Share action buttons (QR + Copy Link) */
.share-action-buttons {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.share-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--color-gray-50);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-action-btn:hover {
    border-color: var(--color-primary);
    background: rgba(67, 170, 139, 0.05);
}

.share-action-btn svg {
    width: 32px;
    height: 32px;
    color: var(--color-gray-500);
}

.share-action-btn:hover svg {
    color: var(--color-primary);
}

.share-action-btn span {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-700);
}

[data-theme="dark"] .share-action-btn {
    background: #2c2c2e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .share-action-btn span {
    color: #e5e5ea;
}

[data-theme="dark"] .share-action-btn:hover {
    border-color: var(--color-primary);
    background: rgba(67, 170, 139, 0.1);
}

/* QR Code modal (shown after clicking QR button) */
.qr-result-section {
    text-align: center;
    padding: var(--space-4);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.qr-result-section img {
    width: 150px;
    height: 150px;
    border-radius: var(--radius-md);
    background: white;
    padding: 8px;
}

.qr-result-section p {
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

.qr-result-section .share-url {
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--color-gray-600);
    word-break: break-all;
    cursor: pointer;
}

.qr-result-section .share-url:hover {
    background: var(--color-gray-100);
}

[data-theme="dark"] .qr-result-section {
    background: #2c2c2e;
}

[data-theme="dark"] .qr-result-section .share-url {
    background: #1c1c1e;
    border-color: #3a3a3c;
    color: #aeaeb2;
}

/* Link copied result */
.link-result-section {
    padding: var(--space-4);
    background: rgba(67, 170, 139, 0.1);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    text-align: center;
}

.link-result-section .success-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-2);
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-result-section .success-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.link-result-section p {
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    font-weight: 500;
}

.link-result-section .share-url {
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    word-break: break-all;
}

/* Divider with text */
.share-divider {
    display: flex;
    align-items: center;
    margin: var(--space-4) 0;
    color: var(--color-gray-400);
    font-size: var(--font-size-sm);
}

.share-divider::before,
.share-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-gray-200);
}

.share-divider span {
    padding: 0 var(--space-3);
}

[data-theme="dark"] .share-divider::before,
[data-theme="dark"] .share-divider::after {
    background: #3a3a3c;
}

/* Fix modal overlay to ensure proper stacking */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
}

/* Ensure modal content doesn't go under header */
.modal-content {
    position: relative;
    z-index: 10001;
}


/* Button loader inside share action buttons */
.share-action-btn .btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.share-action-btn .btn-loader::before,
.share-action-btn .btn-loader::after,
.share-action-btn .btn-loader span {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.share-action-btn .btn-loader::before { animation-delay: 0s; }
.share-action-btn .btn-loader span { display: block; animation-delay: 0.2s; }
.share-action-btn .btn-loader::after { animation-delay: 0.4s; }

/* Ensure modal is always on top of everything */
#share-modal {
    z-index: 10000 !important;
}

#share-modal .modal-content {
    z-index: 10001 !important;
}

/* Fix for modal not going under header on mobile */
@media (max-width: 768px) {
    .share-modal {
        margin: 20px auto;
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px);
    }
}

/* Better vertical centering for modal */
.modal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
}



/* ================================
   SHARE MODAL - REDESIGNED
   ================================ */

/* Modal overlay - prevent double scrollbar */
.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    overflow: hidden; /* Prevent overlay scroll */
}

.share-modal {
    width: 100%;
    max-width: 380px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    margin: 0; /* Remove auto margin that causes movement */
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.share-modal .modal-header {
    flex-shrink: 0;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-gray-100);
}

.share-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    -webkit-overflow-scrolling: touch;
}

/* Clip Expiry Section - AT TOP */
.share-expiry-section {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-gray-100);
}

.share-expiry-section label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: var(--space-2);
}

.share-expiry-options {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* 3 Option Boxes Grid */
.share-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

.share-option-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-2);
    background: var(--color-gray-50);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-option-box:hover {
    border-color: var(--color-primary);
    background: rgba(67, 170, 139, 0.05);
}

.share-option-box:hover svg {
    color: var(--color-primary);
}

.share-option-box svg {
    width: 28px;
    height: 28px;
    color: var(--color-gray-500);
    transition: color var(--transition-fast);
}

.share-option-box span {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-gray-700);
    text-align: center;
}

/* Result Panels */
.share-result-panel {
    animation: fadeIn 0.2s ease;
}

.share-back-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    background: none;
    border: none;
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
    cursor: pointer;
    padding: 0;
    margin-bottom: var(--space-3);
}

.share-back-btn:hover {
    color: var(--color-primary);
}

.share-panel-content {
    display: flex;
    flex-direction: column;
}

/* Link Success Display */
.link-success-display {
    text-align: center;
    padding: var(--space-4);
    background: rgba(67, 170, 139, 0.1);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

.success-icon-small {
    width: 40px;
    height: 40px;
    margin: 0 auto var(--space-2);
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon-small svg {
    width: 20px;
    height: 20px;
    color: white;
}

.link-success-display p {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-700);
    margin: 0;
}

/* URL Display Box */
.share-url-box {
    padding: var(--space-3);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--color-gray-600);
    word-break: break-all;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.share-url-box:hover {
    background: var(--color-gray-100);
}

/* QR Panel */
.qr-panel-content {
    text-align: center;
}

.qr-display {
    display: inline-block;
    padding: 12px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-3);
}

.qr-display img {
    width: 150px;
    height: 150px;
    display: block;
}

.qr-hint {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    margin-bottom: var(--space-3);
}

/* Email form styles */
.share-note {
    min-height: 70px;
    resize: vertical;
    margin-top: var(--space-3);
}

/* Dark mode */
[data-theme="dark"] .share-option-box {
    background: #2c2c2e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .share-option-box span {
    color: #e5e5ea;
}

[data-theme="dark"] .share-option-box:hover {
    border-color: var(--color-primary);
    background: rgba(67, 170, 139, 0.1);
}

[data-theme="dark"] .share-expiry-section {
    border-bottom-color: #2c2c2e;
}

[data-theme="dark"] .share-expiry-section label {
    color: #aeaeb2;
}

[data-theme="dark"] .share-url-box {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #aeaeb2;
}

[data-theme="dark"] .share-url-box:hover {
    background: #3a3a3c;
}

[data-theme="dark"] .link-success-display {
    background: rgba(67, 170, 139, 0.15);
}

[data-theme="dark"] .link-success-display p {
    color: #e5e5ea;
}

[data-theme="dark"] .qr-display {
    background: white;
}

/* ================================
   FIX: Header z-index for modals
   ================================ */
.header {
    z-index: 100; /* Lower than modals */
}

/* Modal overlays always on top */
.modal-overlay {
    z-index: 10000 !important;
}

.modal-content {
    z-index: 10001 !important;
}

/* ================================
   FIX: Desktop paste button in textarea
   ================================ */
.input-card {
    position: relative;
}

.paste-btn-inline {
    position: absolute;
    bottom: 85px; /* Position above action buttons */
    right: 24px;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    color: var(--color-gray-500);
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 5;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.paste-btn-inline:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Show only on desktop with hover capability */
@media (min-width: 768px) and (hover: hover) {
    .paste-btn-inline {
        display: flex;
    }
}

[data-theme="dark"] .paste-btn-inline {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #8e8e93;
}

[data-theme="dark"] .paste-btn-inline:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* ================================
   FIX: Prevent body scroll with modal
   ================================ */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}


/* Toast ALWAYS on top - higher than everything */
.toast-container {
    position: fixed;
    bottom: calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999 !important; /* Higher than modals */
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: calc(100% - var(--space-8));
    max-width: 340px;
    pointer-events: none;
}

.toast {
    z-index: 99999 !important;
}

/* QR Code centered */
.qr-panel-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin: 0 auto var(--space-3);
}

.qr-display img {
    width: 150px;
    height: 150px;
    display: block;
}

/* Share modal - prevent scroll issues on desktop */
.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    overflow-y: auto;
}

.share-modal {
    width: 100%;
    max-width: 380px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Prevent desktop scrollbar issues */
html {
    overflow-y: scroll; /* Always show scrollbar to prevent shift */
}

/* Fixed height panels container to prevent modal resizing */
.share-panels-container {
    min-height: 200px;
    position: relative;
}

.share-options-grid,
.share-result-panel {
    width: 100%;
}

/* Ensure modal body doesn't change size */
.share-modal-body {
    display: flex;
    flex-direction: column;
}

.share-modal {
    width: 100%;
    max-width: 380px;
    /* Remove max-height constraint that causes issues */
}

/* Paste button - subtle, like placeholder text */
.textarea-wrapper {
    position: relative;
}

.paste-btn-ghost {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: var(--color-gray-400);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.2s;
    opacity: 0.6;
}

.paste-btn-ghost:hover {
    color: var(--color-primary);
    opacity: 1;
}

.paste-btn-ghost svg {
    width: 14px;
    height: 14px;
}

[data-theme="dark"] .paste-btn-ghost {
    color: var(--color-gray-500);
}

[data-theme="dark"] .paste-btn-ghost:hover {
    color: var(--color-primary);
}

/* Hide paste button when textarea has content */
.clip-textarea:not(:placeholder-shown) + .paste-btn-ghost {
    display: none;
}



/* Share Modal - FIXED SIZE */
.share-modal-fixed {
    width: 90%;
    max-width: 360px;
}

.share-modal-body-fixed {
    padding: var(--space-4);
}


.share-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.share-panel.hidden {
    display: none;
}

.share-options-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    padding-top: var(--space-2);
}

.share-panel-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: var(--space-2);
}

.share-panel-centered {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.share-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
    cursor: pointer;
    padding: 0;
    margin-bottom: var(--space-2);
}

.share-back-btn:hover {
    color: var(--color-primary);
}

.link-success-display {
    margin-bottom: var(--space-3);
}

.link-success-display p {
    margin: 0;
    font-weight: 500;
    color: var(--color-gray-700);
}

[data-theme="dark"] .link-success-display p {
    color: var(--color-gray-300);
}

.qr-display {
    padding: 12px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-2);
}

.qr-display img {
    width: 120px;
    height: 120px;
    display: block;
}

.qr-hint {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    margin: 0 0 var(--space-2) 0;
}

.share-url-box {
    padding: var(--space-2) var(--space-3);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--color-gray-600);
    word-break: break-all;
    max-width: 100%;
    cursor: pointer;
}

.share-url-box:hover {
    background: var(--color-gray-100);
}

[data-theme="dark"] .share-url-box {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #aeaeb2;
}

.share-note {
    min-height: 60px;
    resize: none;
}


/* Share Modal - Fixed Size with Centered Layout */
.share-modal-fixed {
    width: 90%;
    max-width: 360px;
}

.share-modal-body-fixed {
    padding: var(--space-4);
}

.share-panels-fixed {
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

.share-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.share-panel.hidden {
    display: none;
}

/* Centered expiry section */
.share-expiry-section-centered {
    text-align: center;
    margin-bottom: var(--space-4);
}

.share-expiry-section-centered label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-600);
    margin-bottom: var(--space-2);
}

[data-theme="dark"] .share-expiry-section-centered label {
    color: var(--color-gray-400);
}

.share-expiry-section-centered .share-expiry-options {
    display: inline-flex;
    gap: var(--space-2);
    justify-content: center;
}

/* Share option buttons */
.share-options-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.share-option-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-2);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.share-option-box:hover {
    border-color: var(--color-primary);
    background: rgba(67, 170, 139, 0.05);
}

.share-option-box:disabled {
    opacity: 0.6;
    cursor: wait;
}

.share-option-box svg {
    width: 28px;
    height: 28px;
    color: var(--color-primary);
}

.share-option-box span {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-gray-700);
}

[data-theme="dark"] .share-option-box {
    background: #2c2c2e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .share-option-box span {
    color: var(--color-gray-300);
}

[data-theme="dark"] .share-option-box:hover {
    background: rgba(67, 170, 139, 0.1);
    border-color: var(--color-primary);
}

/* Instructions */
.share-instructions {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    margin: 0;
}

/* Inner panels */
.share-panel-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: var(--space-2);
}

.share-panel-centered {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.share-panel-hint {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    margin: var(--space-2) 0 var(--space-3) 0;
}

.share-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
    cursor: pointer;
    padding: 0;
    margin-bottom: var(--space-2);
}

.share-back-btn:hover {
    color: var(--color-primary);
}

/* Link success display */
.link-success-display {
    margin-bottom: var(--space-3);
}

.link-success-display p {
    margin: 0;
    font-weight: 500;
    color: var(--color-gray-700);
}

[data-theme="dark"] .link-success-display p {
    color: var(--color-gray-300);
}

.success-icon-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-2) auto;
}

.success-icon-small svg {
    width: 24px;
    height: 24px;
}

/* QR display */
.qr-display {
    padding: 12px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-2);
}

.qr-display img {
    width: 120px;
    height: 120px;
    display: block;
}

.qr-hint {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    margin: 0 0 var(--space-2) 0;
}

/* URL box */
.share-url-box {
    padding: var(--space-2) var(--space-3);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--color-gray-600);
    word-break: break-all;
    max-width: 100%;
    cursor: pointer;
    margin-bottom: var(--space-2);
}

.share-url-box:hover {
    background: var(--color-gray-100);
}

[data-theme="dark"] .share-url-box {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #aeaeb2;
}

.share-note {
    min-height: 60px;
    resize: none;
}

.btn-small {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
}


/* Hide paste button by default (Mobile) */
.paste-btn-ghost {
    display: none !important;
}

/* Show only on Desktop */
@media (min-width: 768px) {
    .paste-btn-ghost {
        display: flex !important;
        position: absolute;
        bottom: 12px;
        right: 12px;
        align-items: center;
        gap: 4px;
        padding: 4px 8px;
        background: transparent;
        border: none;
        color: var(--color-gray-400);
        font-size: 13px;
        cursor: pointer;
        opacity: 0.6;
    }
    
    /* Still hide if textarea has content */
    .clip-textarea:not(:placeholder-shown) + .paste-btn-ghost {
        display: none !important;
    }
}

/* Animation for smooth deletion */
.clip-item {
    transition: transform 0.3s ease, opacity 0.3s ease, margin 0.3s ease, height 0.3s ease;
    overflow: hidden;
}

.clip-item.removing {
    transform: translateX(30px);
    opacity: 0;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    height: 0 !important;
    pointer-events: none;
}

#clips-list {
    display: flex;
    flex-direction: column;
    /* Ensure child animations don't cause container jitter */
    overflow-anchor: none; 
}


/* Code Block Truncation */
.code-block.is-long {
    max-height: 350px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.code-block.is-long:hover {
    transform: translateY(-2px);
}

.code-block.is-long pre {
    max-height: 280px;
    overflow: hidden;
    margin-bottom: 0;
}

.code-expand-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, var(--card-bg));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 15px;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none; /* Allows clicks to pass through to the code-block */
}

/* Dark mode adjustment for overlay */
[data-theme="dark"] .code-expand-overlay {
    background: linear-gradient(transparent, #1e1e1e);
}

/* ==================== BATCH OPERATIONS ==================== */

.batch-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-white);
    border-top: 1px solid var(--color-gray-200);
    padding: var(--space-3) var(--space-4);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    z-index: var(--z-modal);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    animation: slideUp 0.2s ease;
    gap: var(--space-2);
}

@media (max-width: 480px) {
    .batch-bar {
        flex-direction: column;
        gap: var(--space-2);
        padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    }
    .batch-bar-left,
    .batch-bar-right {
        width: 100%;
        justify-content: center;
    }
    .batch-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 8px;
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.batch-bar-left,
.batch-bar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.batch-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background: var(--color-white);
    color: var(--color-gray-700);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.batch-btn:hover:not(:disabled) {
    background: var(--color-gray-50);
}

.batch-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.batch-btn.batch-delete {
    color: var(--color-danger);
    border-color: rgba(249, 65, 68, 0.3);
}

.batch-btn.batch-delete:hover:not(:disabled) {
    background: rgba(249, 65, 68, 0.08);
}

.batch-btn.batch-pin {
    color: var(--color-primary);
    border-color: rgba(67, 170, 139, 0.3);
}

.batch-btn.batch-pin:hover:not(:disabled) {
    background: rgba(67, 170, 139, 0.08);
}

.batch-btn.batch-cancel {
    color: var(--color-gray-500);
}

.batch-count {
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
    white-space: nowrap;
}

.batch-mode .clip-item {
    cursor: pointer;
    user-select: none;
}

.batch-mode .clip-item.selected {
    border-color: var(--color-primary);
    background: rgba(67, 170, 139, 0.05);
    box-shadow: 0 0 0 2px rgba(67, 170, 139, 0.2);
}

.batch-mode .clip-actions {
    display: none !important;
}

.batch-mode .clips-section {
    padding-bottom: 100px;
}

@media (max-width: 480px) {
    .batch-mode .clips-section {
        padding-bottom: 140px;
    }
}

/* ==================== SWIPE GESTURES ==================== */

@media (hover: none) and (pointer: coarse) {
    .clip-item {
        touch-action: pan-y;
        position: relative;
    }
}

.clip-item.swipe-delete {
    background: rgba(249, 65, 68, 0.06);
}

.clip-item.swipe-pin {
    background: rgba(67, 170, 139, 0.06);
}

/* ==================== QR SCANNER ==================== */

.qr-scanner-dialog {
    max-width: 400px;
    width: 90vw;
    padding: 0;
    overflow: hidden;
}

.qr-scanner-dialog .dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-gray-200);
}

.qr-scanner-dialog .dialog-header h3 {
    margin: 0;
    font-size: var(--font-size-base);
}

.qr-scanner-hint {
    text-align: center;
    padding: var(--space-3);
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
}

#qr-reader {
    width: 100%;
}

.btn-qr-scan {
    margin-top: var(--space-2);
}

/* Room QR Modal */
.room-qr-dialog {
    text-align: center;
    padding: var(--space-6);
}

.room-qr-dialog h3 {
    margin-bottom: var(--space-1);
}

.room-qr-subtitle {
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
}

.room-qr-display {
    display: inline-block;
    padding: var(--space-3);
    background: white;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-sm);
}

.room-qr-display img {
    width: 200px;
    height: 200px;
    display: block;
}

.room-qr-code {
    font-size: var(--font-size-xl);
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--color-gray-800);
    margin-bottom: var(--space-4);
}

/* ==================== DARK MODE — PHASE 3 ADDITIONS ==================== */

[data-theme="dark"] .batch-bar {
    background: #1c1c1e;
    border-color: #3a3a3c;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

[data-theme="dark"] .batch-btn {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #d1d1d6;
}

[data-theme="dark"] .batch-btn:hover:not(:disabled) {
    background: #3a3a3c;
}

[data-theme="dark"] .batch-mode .clip-item.selected {
    background: rgba(67, 170, 139, 0.1);
}

[data-theme="dark"] .qr-scanner-dialog .dialog-header {
    border-color: #3a3a3c;
}

[data-theme="dark"] .room-qr-display {
    background: white;
}

[data-theme="dark"] .room-qr-code {
    color: #e5e5ea;
}

/* ==========================================
   AI TAGS & CATEGORIES — Phase A
   ========================================== */

/* AI Tags Pills */
.ai-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: var(--space-3);
}

.ai-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    background: rgba(67, 170, 139, 0.10);
    color: #43AA8B;
    line-height: 1.4;
    letter-spacing: 0.01em;
    border: 1px solid rgba(67, 170, 139, 0.18);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.ai-tag:hover {
    background: rgba(67, 170, 139, 0.22);
    border-color: rgba(67, 170, 139, 0.35);
}

[data-theme="dark"] .ai-tag {
    background: rgba(67, 170, 139, 0.14);
    color: #6dd4b1;
    border-color: rgba(67, 170, 139, 0.25);
}

[data-theme="dark"] .ai-tag:hover {
    background: rgba(67, 170, 139, 0.28);
    border-color: rgba(67, 170, 139, 0.4);
}

/* AI Summary — clip title */
.ai-summary {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-gray-800);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-2);
}

[data-theme="dark"] .ai-summary {
    color: #e5e5ea;
}

/* Reminder Badge */
.clip-reminder {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin-top: var(--space-3);
    background: #fff8e1;
    border: 1px solid #ffecb3;
    border-radius: var(--radius-md);
    font-size: 12px;
    color: #e65100;
    font-weight: 500;
}

.clip-reminder i {
    font-size: 13px;
}

.clip-reminder.sent {
    background: var(--color-gray-100);
    border-color: var(--color-gray-200);
    color: var(--color-gray-500);
    font-weight: 400;
}

.reminder-calendar-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 15px;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    line-height: 1;
}

.reminder-calendar-btn:hover {
    background: rgba(67, 170, 139, 0.12);
}

[data-theme="dark"] .clip-reminder {
    background: rgba(255, 152, 0, 0.1);
    border-color: rgba(255, 152, 0, 0.2);
    color: #ffb74d;
}

[data-theme="dark"] .clip-reminder.sent {
    background: var(--color-gray-800);
    border-color: var(--color-gray-700);
    color: var(--color-gray-500);
}

[data-theme="dark"] .reminder-calendar-btn:hover {
    background: rgba(67, 170, 139, 0.18);
}

/* Settings Notification Toggle */
.notification-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.settings-description {
    font-size: 13px;
    color: var(--color-gray-500);
    margin-bottom: 12px;
    margin-top: 0;
}

.settings-note {
    font-size: 12px;
    color: var(--color-gray-400);
    font-style: italic;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-gray-300);
    transition: background-color var(--transition-base);
    border-radius: 24px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: transform var(--transition-base);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

[data-theme="dark"] .toggle-slider {
    background-color: var(--color-gray-600);
}

/* Clip Timestamp */
.clip-timestamp {
    font-size: 11px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.edited-badge {
    font-style: italic;
    opacity: 0.7;
}

/* Category Icon (FontAwesome) */
.category-icon {
    margin-right: 4px;
    font-size: 13px;
    vertical-align: middle;
    opacity: 0.8;
}

/* Auto Expiry Option */
.expiry-option[data-expiry="auto"] {
    position: relative;
}

.expiry-option[data-expiry="auto"].active {
    background: linear-gradient(135deg, var(--primary, #43AA8B), #3d9be0);
    color: white;
    border-color: transparent;
}

/* Expiry reason tooltip (via native title attr, styled on hover) */
.clip-expiry[title]:hover {
    cursor: help;
}

/* AI Processing Spinner */
.ai-processing-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: ai-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.btn.ai-processing {
    background: linear-gradient(135deg, var(--primary, #43AA8B), #3d9be0);
    pointer-events: none;
    opacity: 0.9;
}

/* ==========================================
   Upload Button Loading State
   ========================================== */
.btn.upload-loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn.upload-loading svg {
    animation: ai-spin 1s linear infinite;
}

/* ==========================================
   Phase B: Voice Recording
   ========================================== */

/* Mic button in input actions */
.btn-voice {
    position: relative;
}

.btn-voice.recording {
    background: var(--color-danger) !important;
    color: white !important;
    border-color: var(--color-danger) !important;
    animation: voice-pulse 1.5s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249, 65, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(249, 65, 68, 0); }
}

/* Voice recording bar — replaces upload progress area during recording */
.voice-recording-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: rgba(249, 65, 68, 0.06);
    border: 1px solid rgba(249, 65, 68, 0.2);
    border-radius: var(--radius-lg);
    margin-top: var(--space-3);
}

.voice-recording-dot {
    width: 10px;
    height: 10px;
    background: var(--color-danger);
    border-radius: 50%;
    animation: voice-blink 1s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes voice-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.voice-recording-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.voice-recording-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-danger);
}

.voice-recording-timer {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    font-variant-numeric: tabular-nums;
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
}

.voice-waveform span {
    width: 3px;
    background: var(--color-danger);
    border-radius: 2px;
    animation: voice-wave 0.8s ease-in-out infinite;
}

.voice-waveform span:nth-child(1) { height: 8px; animation-delay: 0s; }
.voice-waveform span:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.voice-waveform span:nth-child(3) { height: 12px; animation-delay: 0.2s; }
.voice-waveform span:nth-child(4) { height: 20px; animation-delay: 0.3s; }
.voice-waveform span:nth-child(5) { height: 10px; animation-delay: 0.4s; }

@keyframes voice-wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* voice-recording-actions, voice-btn-stop, voice-btn-cancel removed — mic button toggles to stop */

/* Voice preview bar — after recording stops */
.voice-preview-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    margin-top: var(--space-3);
}

.voice-preview-bar audio {
    flex: 1;
    height: 36px;
    min-width: 0;
}

.voice-preview-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* Voice mode toggle (Audio / Text) */
.voice-mode-toggle {
    display: flex;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.voice-mode-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-1) var(--space-2);
    background: none;
    border: none;
    font-size: var(--font-size-xs);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.voice-mode-btn i {
    font-size: 11px;
}

.voice-mode-btn + .voice-mode-btn {
    border-left: 1px solid var(--color-gray-300);
}

.voice-mode-btn.active {
    background: var(--color-primary);
    color: white;
}

.voice-mode-btn:not(.active):hover {
    background: var(--color-gray-100);
}

.voice-btn-discard {
    display: flex;
    align-items: center;
    padding: var(--space-2);
    background: none;
    color: var(--color-gray-500);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
}

.voice-btn-discard:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* Dark mode: voice recording */
[data-theme="dark"] .voice-recording-bar {
    background: rgba(249, 65, 68, 0.1);
    border-color: rgba(249, 65, 68, 0.3);
}

[data-theme="dark"] .voice-preview-bar {
    background: #2c2c2e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .voice-btn-discard {
    border-color: #48484a;
    color: #8e8e93;
}

[data-theme="dark"] .voice-mode-toggle {
    border-color: #48484a;
}

[data-theme="dark"] .voice-mode-btn {
    color: #8e8e93;
}

[data-theme="dark"] .voice-mode-btn + .voice-mode-btn {
    border-left-color: #48484a;
}

[data-theme="dark"] .voice-mode-btn:not(.active):hover {
    background: #3a3a3c;
}

/* Dark mode: visual hierarchy */
[data-theme="dark"] .clips-section {
    border-top-color: #3a3a3c;
}

[data-theme="dark"] .header {
    border-bottom-color: #3a3a3c;
}

[data-theme="dark"] .clip-item {
    border-color: #48484a;
}

