/* Liquid Glass Theme - True iOS 26 Style with SVG Filters */

/* Background animation like the example */
@keyframes moveBackground {
    from { background-position: 0% 0%; }
    to { background-position: 0% -1000%; }
}

@keyframes shimmer {
    0% { opacity: 0.3; }
    50% { opacity: 0.5; }
    100% { opacity: 0.3; }
}

/* ===== BASE THEME SETUP ===== */
body.theme-liquid-glass-light,
body.theme-liquid-glass-dark {
    margin: 0;
    min-height: 100vh;
    background-size: 300px;
    animation: moveBackground 80s linear infinite;
    background-attachment: fixed;
    
    /* Glass-specific variables */
    --glass-blur: 0px;
    --glass-saturate: 180%;
}

/* ===== LIGHT THEME - Clean Grey/White/Orange ===== */
body.theme-liquid-glass-light {
    background-color: #e8ecf2;
    background-image: 
        /* Soft orange accent */
        radial-gradient(ellipse at 20% 30%, rgba(243, 123, 32, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(243, 123, 32, 0.06) 0%, transparent 45%),
        /* Subtle grey waves */
        radial-gradient(circle at 60% 20%, rgba(100, 116, 139, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 30% 80%, rgba(148, 163, 184, 0.1) 0%, transparent 50%),
        /* Base clean gradient */
        linear-gradient(135deg, #f8fafc 0%, #e2e8f0 30%, #f1f5f9 70%, #ffffff 100%);
    
    background-size: 100% 100%;
    animation: none;
    
    --glass-bg: rgba(255, 255, 255, 0.5);
    --glass-bg-solid: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: rgba(0, 0, 0, 0.06);
    --glass-text: #1a1a1a;
    --glass-text-secondary: #4a4a4a;
    --accent-color: #F37B20;
    --accent-glow: rgba(243, 123, 32, 0.35);
}

/* ===== DARK THEME - Elegant Dark with Orange Accents ===== */
body.theme-liquid-glass-dark {
    background-color: #0f1115;
    background-image: 
        /* Subtle orange glow spots */
        radial-gradient(circle at 15% 25%, rgba(243, 123, 32, 0.12) 0%, transparent 35%),
        radial-gradient(circle at 85% 75%, rgba(243, 123, 32, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(255, 158, 94, 0.05) 0%, transparent 50%),
        /* Dark elegant mesh */
        radial-gradient(circle at 20% 80%, rgba(30, 35, 45, 0.8) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(25, 30, 40, 0.8) 0%, transparent 50%),
        /* Base gradient - dark charcoal/graphite */
        linear-gradient(135deg, #0a0c0f 0%, #141820 40%, #0d1014 70%, #080a0d 100%);
    
    background-size: 400% 400%;
    animation: liquidMoveDark 30s ease infinite;
    
    color: #f0f0f0;

    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-bg-solid: rgba(20, 24, 32, 0.85);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: rgba(0, 0, 0, 0.5);
    --glass-text: #ffffff;
    --glass-text-secondary: #a0a8b8;
    --accent-color: #F37B20;
    --accent-glow: rgba(243, 123, 32, 0.4);
}

@keyframes liquidMoveDark {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* ===== TRUE GLASS EFFECT - Using ::before and ::after ===== */

/* Glass container mixin */
body[class*="theme-liquid-glass"] .sidebar,
body[class*="theme-liquid-glass"] .input-wrapper,
body[class*="theme-liquid-glass"] .modal-content,
body[class*="theme-liquid-glass"] .media-input-wrapper,
body[class*="theme-liquid-glass"] .media-settings-panel {
    position: relative;
    background: transparent !important;
    border-radius: 24px;
    overflow: hidden;
}

/* Inner glow layer - like the example */
body[class*="theme-liquid-glass"] .sidebar::before,
body[class*="theme-liquid-glass"] .input-wrapper::before,
body[class*="theme-liquid-glass"] .modal-content::before,
body[class*="theme-liquid-glass"] .media-input-wrapper::before,
body[class*="theme-liquid-glass"] .media-settings-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    border-radius: inherit;
    box-shadow: 
        inset 2px 2px 0px -1px rgba(255, 255, 255, 0.5),
        inset 0 0 4px 1px rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

/* Glass blur layer - like the example */
body[class*="theme-liquid-glass"] .sidebar::after,
body[class*="theme-liquid-glass"] .input-wrapper::after,
body[class*="theme-liquid-glass"] .modal-content::after,
body[class*="theme-liquid-glass"] .media-input-wrapper::after,
body[class*="theme-liquid-glass"] .media-settings-panel::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: inherit;
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    filter: url(#glass-filter);
    overflow: hidden;
    isolation: isolate;
    background: var(--glass-bg);
    will-change: transform, backdrop-filter;
    transform: translateZ(0);
}

/* Sidebar specific */
body[class*="theme-liquid-glass"] .sidebar {
    border: 1px solid var(--glass-border) !important;
    border-left: none !important;
    border-radius: 0 24px 24px 0;
    box-shadow: 0 8px 32px var(--glass-shadow);
}

/* Cards */
body[class*="theme-liquid-glass"] .project-card,
body[class*="theme-liquid-glass"] .gem-card {
    position: relative;
    background: transparent !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px;
    overflow: hidden;
}

body[class*="theme-liquid-glass"] .project-card::before,
body[class*="theme-liquid-glass"] .gem-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    box-shadow: 
        inset 2px 2px 0px -1px rgba(255, 255, 255, 0.4),
        inset 0 0 3px 1px rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

body[class*="theme-liquid-glass"] .project-card::after,
body[class*="theme-liquid-glass"] .gem-card::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: inherit;
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    background: var(--glass-bg);
    will-change: transform, backdrop-filter;
    transform: translateZ(0);
}

/* ===== DROPDOWN ITEMS ===== */
body[class*="theme-liquid-glass"] .model-option,
body[class*="theme-liquid-glass"] .settings-menu-item,
body[class*="theme-liquid-glass"] .select-option {
    transition: all 0.2s ease;
    border-radius: 12px;
    margin: 4px 8px;
}

body[class*="theme-liquid-glass"] .model-option:hover,
body[class*="theme-liquid-glass"] .settings-menu-item:hover,
body[class*="theme-liquid-glass"] .select-option:hover {
    background: rgba(243, 123, 32, 0.15) !important;
}

body[class*="theme-liquid-glass"] .model-option.active {
    background: rgba(243, 123, 32, 0.2) !important;
    border: 1px solid rgba(243, 123, 32, 0.3);
}

/* ===== HEADER & CHAT HEADER ===== */
body[class*="theme-liquid-glass"] .chat-header,
body[class*="theme-liquid-glass"] .canvas-header {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-bottom: 1px solid var(--glass-border) !important;
    will-change: transform, backdrop-filter;
    transform: translateZ(0);
}

body[class*="theme-liquid-glass"] .chat-header-container .canvas-header {
    position: relative !important;
}

body[class*="theme-liquid-glass"] .model-selector {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

body[class*="theme-liquid-glass"] .model-selector:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(243, 123, 32, 0.3) !important;
}

/* ===== BUTTONS - Glass Style ===== */
body[class*="theme-liquid-glass"] .btn-primary,
body[class*="theme-liquid-glass"] .new-chat-btn {
    position: relative;
    background: transparent !important;
    border: none !important;
    border-radius: 9999px;
    color: white !important;
    font-weight: 600;
    overflow: hidden;
}

body[class*="theme-liquid-glass"] .btn-primary::before,
body[class*="theme-liquid-glass"] .new-chat-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 
        inset 2px 2px 0px -1px rgba(255, 255, 255, 0.5),
        inset 0 0 3px 1px rgba(255, 255, 255, 0.3);
    background: rgba(243, 123, 32, 0.25);
    pointer-events: none;
}

body[class*="theme-liquid-glass"] .btn-primary:hover,
body[class*="theme-liquid-glass"] .new-chat-btn:hover {
    transform: translateY(-2px);
}

body[class*="theme-liquid-glass"] .btn-primary:hover::before,
body[class*="theme-liquid-glass"] .new-chat-btn:hover::before {
    background: rgba(243, 123, 32, 0.35);
}

body[class*="theme-liquid-glass"] .btn-secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

body[class*="theme-liquid-glass"] .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* ===== SEND BUTTON - Glass Circle ===== */
body[class*="theme-liquid-glass"] .send-btn {
    background: transparent !important;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

body[class*="theme-liquid-glass"] .send-btn.active {
    background: rgba(243, 123, 32, 0.3) !important;
    border-radius: 50% !important;
    box-shadow: 
        inset 2px 2px 0px -1px rgba(255, 255, 255, 0.4),
        inset 0 0 3px 1px rgba(255, 255, 255, 0.2),
        0 4px 15px rgba(243, 123, 32, 0.3);
}

body[class*="theme-liquid-glass"] .send-btn.active,
body[class*="theme-liquid-glass"] .send-btn.active svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

body[class*="theme-liquid-glass"] .send-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== INPUT FIELDS ===== */
body[class*="theme-liquid-glass"] .form-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px;
    color: var(--glass-text);
}

body[class*="theme-liquid-glass"] .chat-input,
body[class*="theme-liquid-glass"] .media-input {
    background: transparent !important;
    border: none !important;
    color: var(--glass-text);
}

body[class*="theme-liquid-glass"] .form-input:focus {
    border-color: rgba(243, 123, 32, 0.4) !important;
    box-shadow: 0 0 20px rgba(243, 123, 32, 0.15);
}

/* ===== SIDEBAR ITEMS ===== */
body[class*="theme-liquid-glass"] .nav-item:hover,
body[class*="theme-liquid-glass"] .history-item:hover,
body[class*="theme-liquid-glass"] .gem-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
}

body[class*="theme-liquid-glass"] .nav-item.active {
    background: rgba(243, 123, 32, 0.15) !important;
    border-radius: 12px;
    border-left: 3px solid var(--accent-color);
}

/* ===== MESSAGE AVATARS ===== */
body[class*="theme-liquid-glass"] .message-avatar {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid var(--glass-border);
    box-shadow: 
        inset 1px 1px 0px rgba(255, 255, 255, 0.3),
        0 4px 15px rgba(0, 0, 0, 0.2);
}

body[class*="theme-liquid-glass"] .typing-indicator-row .message-avatar {
    animation: avatar-breathe 2s infinite ease-in-out;
    background: rgba(243, 123, 32, 0.2) !important;
    border: 1px solid rgba(243, 123, 32, 0.4);
    box-shadow: 
        inset 1px 1px 0px rgba(255, 255, 255, 0.3),
        0 0 25px rgba(243, 123, 32, 0.3);
}

@keyframes avatar-breathe {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 
            inset 1px 1px 0px rgba(255, 255, 255, 0.3),
            0 0 20px rgba(243, 123, 32, 0.3);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 
            inset 1px 1px 0px rgba(255, 255, 255, 0.4),
            0 0 35px rgba(243, 123, 32, 0.4);
    }
}

/* ===== CHIPS & TAGS - Glass Pill ===== */
body[class*="theme-liquid-glass"] .hero-chip,
body[class*="theme-liquid-glass"] .suggestion-chip {
    position: relative;
    background: transparent !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 100px;
    transition: all 0.2s ease;
    overflow: hidden;
}

body[class*="theme-liquid-glass"] .hero-chip::before,
body[class*="theme-liquid-glass"] .suggestion-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 
        inset 1px 1px 0px rgba(255, 255, 255, 0.3),
        inset 0 0 2px rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

body[class*="theme-liquid-glass"] .hero-chip:hover,
body[class*="theme-liquid-glass"] .suggestion-chip:hover {
    transform: translateY(-2px);
}

body[class*="theme-liquid-glass"] .hero-chip:hover::before,
body[class*="theme-liquid-glass"] .suggestion-chip:hover::before {
    background: rgba(243, 123, 32, 0.15);
}

/* ===== SCROLLBARS ===== */
body[class*="theme-liquid-glass"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body[class*="theme-liquid-glass"] ::-webkit-scrollbar-track {
    background: transparent;
}

body[class*="theme-liquid-glass"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

body[class*="theme-liquid-glass"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ===== REMOVE SOLID BACKGROUNDS ===== */
body[class*="theme-liquid-glass"] .main-content,
body[class*="theme-liquid-glass"] .app-container,
body[class*="theme-liquid-glass"] .chat-view,
body[class*="theme-liquid-glass"] .create-media-layout {
    background-color: transparent !important;
}

/* ===== WELCOME SCREEN ===== */
body[class*="theme-liquid-glass"] .welcome-message h1 {
    background: linear-gradient(135deg, #F37B20 0%, #FF9E5E 50%, #ffffff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== LOADING ANIMATION ===== */
body[class*="theme-liquid-glass"] .loading-dots .dot {
    background: rgba(243, 123, 32, 0.6) !important;
    box-shadow: 
        inset 1px 1px 0px rgba(255, 255, 255, 0.4),
        0 0 10px rgba(243, 123, 32, 0.4);
}

/* ===== AVATAR OPTIONS IN SETTINGS ===== */
body[class*="theme-liquid-glass"] .avatar-option {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

body[class*="theme-liquid-glass"] .avatar-option:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--glass-border);
}

body[class*="theme-liquid-glass"] .avatar-option.selected {
    background: rgba(243, 123, 32, 0.2) !important;
    border-color: rgba(243, 123, 32, 0.5) !important;
    box-shadow: 
        inset 1px 1px 0px rgba(255, 255, 255, 0.3),
        0 0 15px rgba(243, 123, 32, 0.2);
}

/* ===== CARDS HOVER ===== */
body[class*="theme-liquid-glass"] .project-card:hover,
body[class*="theme-liquid-glass"] .gem-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px var(--glass-shadow);
    border-color: rgba(243, 123, 32, 0.3) !important;
}

/* ===== ENSURE Z-INDEX FOR MENUS ===== */
body[class*="theme-liquid-glass"] .settings-menu,
body[class*="theme-liquid-glass"] .settings-submenu,
body[class*="theme-liquid-glass"] .avatars-submenu,
body[class*="theme-liquid-glass"] .model-dropdown,
body[class*="theme-liquid-glass"] #media-model-dropdown {
    z-index: 10000 !important;
}

body[class*="theme-liquid-glass"] .settings-menu {
    overflow: visible !important;
}

body[class*="theme-liquid-glass"] .settings-menu-item,
body[class*="theme-liquid-glass"] .model-option,
body[class*="theme-liquid-glass"] .avatar-option {
    pointer-events: auto !important;
}

/* ===== LIGHT THEME TEXT ===== */
body.theme-liquid-glass-light {
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
}

body.theme-liquid-glass-light .sidebar,
body.theme-liquid-glass-light .settings-menu,
body.theme-liquid-glass-light .model-dropdown {
    color: #1a1a1a;
}

body.theme-liquid-glass-light .nav-item,
body.theme-liquid-glass-light .history-item,
body.theme-liquid-glass-light .gem-item,
body.theme-liquid-glass-light .settings-menu-item {
    color: #2a2a2a;
}

body.theme-liquid-glass-light .section-title {
    color: #5a5a5a;
}

/* ===== DARK THEME TEXT ===== */
body.theme-liquid-glass-dark {
    --text-primary: #f0f0f0;
    --text-secondary: #a0a8b8;
}

/* ===== MODAL OVERLAY ===== */
body[class*="theme-liquid-glass"] .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

body.theme-liquid-glass-light .modal-overlay {
    background: rgba(255, 255, 255, 0.4);
}

/* ===== SMOOTH TRANSITIONS ===== */
body[class*="theme-liquid-glass"] * {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== FOCUS STATES ===== */
body[class*="theme-liquid-glass"] button:focus-visible,
body[class*="theme-liquid-glass"] input:focus-visible,
body[class*="theme-liquid-glass"] textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(243, 123, 32, 0.3) !important;
}

/* ===== DIVIDERS ===== */
body[class*="theme-liquid-glass"] .settings-divider {
    border-top: 1px solid var(--glass-border);
}

/* ===== TOOL BUTTONS ===== */
body[class*="theme-liquid-glass"] .tool-btn,
body[class*="theme-liquid-glass"] .action-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid transparent !important;
    border-radius: 10px;
    transition: all 0.2s ease;
}

body[class*="theme-liquid-glass"] .tool-btn:hover,
body[class*="theme-liquid-glass"] .action-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: var(--glass-border) !important;
}

/* ===== NOTIFICATION/TOAST ===== */
body[class*="theme-liquid-glass"] .notification {
    background: var(--glass-bg-solid) !important;
    backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border) !important;
    border-radius: 16px;
    box-shadow: 
        inset 2px 2px 0px -1px rgba(255, 255, 255, 0.3),
        0 15px 35px rgba(0, 0, 0, 0.3);
}

/* ===== TABS ===== */
body[class*="theme-liquid-glass"] .tab-btn {
    background: transparent !important;
    border-radius: 10px;
}

body[class*="theme-liquid-glass"] .tab-btn.active {
    background: rgba(243, 123, 32, 0.15) !important;
    color: var(--glass-text);
}

body[class*="theme-liquid-glass"] .tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* ===== CODE BLOCKS ===== */
body[class*="theme-liquid-glass"] pre,
body[class*="theme-liquid-glass"] code {
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

body.theme-liquid-glass-light pre,
body.theme-liquid-glass-light code {
    background: rgba(0, 0, 0, 0.06) !important;
}

/* ===== PROGRESS/LOADING BAR ===== */
body[class*="theme-liquid-glass"] .progress-bar {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

body[class*="theme-liquid-glass"] .progress-fill {
    background: linear-gradient(90deg, rgba(243, 123, 32, 0.8), rgba(255, 158, 94, 0.8));
}

/* ===== GENERATE AI BUTTON ===== */
body[class*="theme-liquid-glass"] #generate-instructions-btn,
body[class*="theme-liquid-glass"] #improve-prompt-btn {
    position: relative;
    background: transparent !important;
    color: white !important;
    border: none !important;
    overflow: hidden;
}

body[class*="theme-liquid-glass"] #generate-instructions-btn::before,
body[class*="theme-liquid-glass"] #improve-prompt-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 
        inset 2px 2px 0px -1px rgba(255, 255, 255, 0.5),
        inset 0 0 3px 1px rgba(255, 255, 255, 0.3);
    background: rgba(243, 123, 32, 0.35);
    pointer-events: none;
}

body[class*="theme-liquid-glass"] #generate-instructions-btn:hover::before,
body[class*="theme-liquid-glass"] #improve-prompt-btn:hover::before {
    background: rgba(243, 123, 32, 0.45);
}

/* ===== INPUT WRAPPER CONTENT Z-INDEX ===== */
body[class*="theme-liquid-glass"] .input-wrapper > *,
body[class*="theme-liquid-glass"] .media-input-wrapper > * {
    position: relative;
    z-index: 2;
}

body[class*="theme-liquid-glass"] .sidebar > * {
    position: relative;
    z-index: 2;
}

body[class*="theme-liquid-glass"] .modal-content > * {
    position: relative;
    z-index: 2;
}
