/* ============================================
   796Helper - Page Styles
   ============================================ */

/* ===========================================
   Dashboard Page
   =========================================== */

.dashboard-page {
    padding: var(--space-xl);
    max-width: 960px;
    margin: 0 auto;
}

/* Welcome Section */
.dashboard-welcome {
    margin-bottom: var(--space-2xl);
    animation: fadeInUp 0.4s ease;
}

.dashboard-welcome .greeting {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-sm);
    line-height: 1.2;
}

.dashboard-welcome .greeting-name {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-welcome .date-info {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}

/* Feature Cards Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.feature-card {
    animation: fadeInUp 0.4s ease backwards;
}

.feature-card:nth-child(1) { animation-delay: 0.05s; }
.feature-card:nth-child(2) { animation-delay: 0.1s; }
.feature-card:nth-child(3) { animation-delay: 0.15s; }
.feature-card:nth-child(4) { animation-delay: 0.2s; }
.feature-card:nth-child(5) { animation-delay: 0.25s; }

.feature-card .card-status {
    margin-top: var(--space-md);
}

/* Dashboard Footer */
.dashboard-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    padding: var(--space-lg) 0;
}

@media (max-width: 768px) {
    .dashboard-page {
        padding: var(--space-lg) var(--space-md);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .dashboard-welcome .greeting {
        font-size: var(--font-size-xl);
    }
}

@media (max-width: 480px) {
    .dashboard-page {
        padding: var(--space-md) var(--space-sm);
    }

    .dashboard-welcome {
        margin-bottom: var(--space-lg);
    }

    .dashboard-welcome .greeting {
        font-size: var(--font-size-lg);
    }

    .dashboard-welcome .date-info {
        font-size: var(--font-size-xs);
    }

    .dashboard-grid {
        gap: var(--space-sm);
    }

    .dashboard-footer {
        padding: var(--space-md) 0;
    }
}

/* ===========================================
   Chat Page
   =========================================== */

.chat-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Chat Welcome State */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-2xl);
    animation: fadeIn 0.5s ease;
}

.chat-welcome .welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xl);
    background: var(--gradient-subtle);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-glow);
}

.chat-welcome .welcome-icon svg {
    width: 40px;
    height: 40px;
    color: var(--primary-light);
}

.chat-welcome .welcome-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-sm);
}

.chat-welcome .welcome-subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    max-width: 400px;
}

.chat-welcome .welcome-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
    max-width: 500px;
}

/* Message Bubble */
.message {
    display: flex;
    gap: var(--space-sm);
    max-width: 85%;
    animation: slideUp 0.3s ease;
}

.message-ai {
    align-self: flex-start;
}

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.message-ai .message-avatar {
    background: var(--gradient-subtle);
    border: 1px solid var(--border-default);
}

.message-ai .message-avatar svg {
    width: 18px;
    height: 18px;
    color: var(--primary-light);
}

.message-user .message-avatar {
    background: var(--gradient-primary);
}

.message-user .message-avatar svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    line-height: 1.6;
    word-break: break-word;
}

.message-ai .message-bubble {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    border-top-left-radius: var(--radius-sm);
    color: var(--text-primary);
}

.message-user .message-bubble {
    background: var(--gradient-primary);
    color: #fff;
    border-top-right-radius: var(--radius-sm);
    box-shadow: var(--shadow-glow);
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.message-user .message-time {
    text-align: right;
}

/* Typing Indicator */
.message-typing .message-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 20px;
}

/* Chat Input Area */
.chat-input-area {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-default);
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--space-sm);
    max-width: 800px;
    margin: 0 auto;
}

.chat-input-container {
    flex: 1;
    position: relative;
    border-radius: var(--radius-lg);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    transition: all var(--transition-fast);
    overflow: hidden;
}

.chat-input-container:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1), var(--shadow-glow);
}

.chat-input {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
}

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

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.chat-send-btn:hover {
    box-shadow: var(--shadow-glow-strong);
    transform: translateY(-1px);
}

.chat-send-btn:active {
    transform: translateY(0) scale(0.95);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

.chat-input-hint {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

@media (max-width: 768px) {
    .chat-messages {
        padding: var(--space-md);
    }

    .chat-input-area {
        padding: var(--space-sm) var(--space-md);
        padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
    }

    .message {
        max-width: 90%;
    }

    .chat-welcome {
        padding: var(--space-lg);
    }

    .chat-welcome .welcome-icon {
        width: 64px;
        height: 64px;
    }

    .chat-welcome .welcome-icon svg {
        width: 32px;
        height: 32px;
    }

    .chat-welcome .welcome-title {
        font-size: var(--font-size-lg);
    }

    .chat-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .chat-messages {
        padding: var(--space-sm);
        gap: var(--space-sm);
    }

    .chat-input-area {
        padding: var(--space-xs) var(--space-sm);
        padding-bottom: calc(var(--space-xs) + env(safe-area-inset-bottom, 0px));
    }

    .message {
        max-width: 95%;
    }

    .message-bubble {
        padding: 10px 12px;
        font-size: var(--font-size-sm);
    }

    .message-avatar {
        width: 28px;
        height: 28px;
    }

    .message-ai .message-avatar svg {
        width: 14px;
        height: 14px;
    }

    .message-user .message-avatar svg {
        width: 12px;
        height: 12px;
    }

    .chat-welcome {
        padding: var(--space-md);
    }

    .chat-welcome .welcome-icon {
        width: 56px;
        height: 56px;
    }

    .chat-welcome .welcome-icon svg {
        width: 28px;
        height: 28px;
    }

    .chat-welcome .welcome-title {
        font-size: var(--font-size-md);
    }

    .chat-welcome .welcome-subtitle {
        font-size: var(--font-size-xs);
    }

    .chat-welcome .welcome-tags {
        gap: var(--space-xs);
    }

    .chat-send-btn {
        width: 40px;
        height: 40px;
    }

    .chat-send-btn svg {
        width: 18px;
        height: 18px;
    }

    .chat-input-hint {
        display: none;
    }

    .chat-input-wrapper {
        gap: var(--space-xs);
    }

    .chat-input {
        padding: 10px 12px;
    }
}

/* ===========================================
   Movie Search Page (Optimized)
   =========================================== */

.movie-search-page {
    padding: var(--space-xl);
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    animation: fadeInUp 0.4s ease;
}

/* --- Search Area --- */
.movie-search-area {
    animation: fadeInUp 0.4s ease;
}

.movie-search-box {
    display: flex;
    gap: var(--space-sm);
    align-items: stretch;
}

.movie-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    overflow: hidden;
}

.movie-search-input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1), var(--shadow-glow);
}

.movie-search-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.movie-search-input-wrapper:focus-within .movie-search-icon {
    color: var(--primary-light);
}

.movie-search-input {
    width: 100%;
    padding: 14px 44px 14px 48px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: var(--font-size-md);
    font-family: var(--font-family);
    line-height: 1.5;
}

.movie-search-input::placeholder {
    color: var(--text-muted);
}

.movie-search-clear-btn {
    position: absolute;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.movie-search-clear-btn:hover {
    background: var(--sidebar-hover-bg);
    color: var(--text-primary);
}

.movie-search-clear-btn svg {
    width: 16px;
    height: 16px;
}

.movie-search-clear-btn.hidden {
    display: none;
}

.movie-search-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0 24px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    color: #fff;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}

.movie-search-btn:hover {
    box-shadow: var(--shadow-glow-strong);
    transform: translateY(-1px);
}

.movie-search-btn:active {
    transform: translateY(0) scale(0.97);
}

.movie-search-btn svg {
    width: 18px;
    height: 18px;
}

/* --- Source Selector (pre-search) --- */
.movie-source-selector {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    justify-content: center;
}

.movie-source-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.movie-source-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
    border-radius: inherit;
}

.movie-source-option:hover {
    border-color: var(--border-glow);
    color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.movie-source-option.active {
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.movie-source-option.active::before {
    opacity: 1;
}

.movie-source-option svg,
.movie-source-option .movie-source-option-label {
    position: relative;
    z-index: 1;
}

.movie-source-option-label {
    font-weight: var(--font-weight-medium);
}



/* --- Filter Bar (post-search) --- */
.movie-filter-bar {

    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    animation: fadeInUp 0.3s ease 0.1s backwards;
}

.movie-filter-bar.hidden {
    display: none;
}

.movie-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.movie-filter-tag:hover {
    border-color: var(--border-glow);
    color: var(--primary-light);
    background: var(--sidebar-active-bg);
}

.movie-filter-tag.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.movie-filter-tag.active .movie-filter-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.movie-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: rgba(108, 92, 231, 0.12);
    color: var(--primary-light);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
}

/* --- Content Area / States --- */
.movie-content-area {
    min-height: 300px;
}

/* Common State Styles */
.movie-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    animation: fadeIn 0.5s ease;
}

.movie-state-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xl);
    background: var(--gradient-subtle);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-glow);
}

.movie-state-icon svg {
    width: 36px;
    height: 36px;
    color: var(--primary-light);
}

.movie-state-icon-error {
    background: rgba(255, 118, 117, 0.1);
    border-color: rgba(255, 118, 117, 0.2);
    box-shadow: 0 0 20px rgba(255, 118, 117, 0.1);
}

.movie-state-icon-error svg {
    color: var(--error);
}

.movie-state-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.movie-state-desc {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.6;
}

.movie-state-desc code {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 0.92em;
    word-break: break-all;
}


/* Welcome State - Animated Visual */
.movie-welcome-visual {
    position: relative;
    margin-bottom: var(--space-lg);
}

.movie-welcome-orb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.2) 0%, rgba(0, 206, 201, 0.08) 60%, transparent 80%);
    animation: movieOrbPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes movieOrbPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

.movie-welcome-visual .movie-state-icon {
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}

/* Loading State - Custom Spinner */
.movie-loading-spinner {
    position: relative;
    width: 72px;
    height: 72px;
    margin-bottom: var(--space-lg);
}

.movie-spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid var(--border-default);
    border-top-color: var(--primary-light);
    border-right-color: var(--accent);
    animation: movieSpin 1s linear infinite;
}

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

.movie-spinner-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    animation: movieSpinnerPulse 1.5s ease-in-out infinite;
}

@keyframes movieSpinnerPulse {
    0%, 100% { opacity: 0.5; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1); }
}

.movie-state-loading {
    gap: var(--space-sm);
}

/* Retry Button in Error State */
.movie-retry-btn {
    margin-top: var(--space-lg);
}

/* --- Results --- */
.movie-results-header {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    padding-left: var(--space-xs);
}

.movie-results-header strong {
    color: var(--primary-light);
    font-weight: var(--font-weight-semibold);
}

.movie-results-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* --- Result Card --- */
.movie-result-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    animation: fadeInUp 0.3s ease backwards;
}

.movie-result-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.movie-result-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.movie-result-info {
    flex: 1;
    min-width: 0;
}

.movie-result-title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
    word-break: break-word;
}

.movie-result-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.movie-source-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    line-height: 1.6;
    white-space: nowrap;
}

.movie-result-code {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.movie-result-code strong {
    color: var(--accent);
    font-weight: var(--font-weight-semibold);
}

.movie-result-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* --- Result Actions --- */
.movie-result-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.movie-result-link-btn,
.movie-result-copy-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.movie-result-link-btn svg,
.movie-result-copy-btn svg {
    width: 16px;
    height: 16px;
}

.movie-result-link-btn:hover {
    background: var(--sidebar-active-bg);
    border-color: var(--border-glow);
    color: var(--primary-light);
}

.movie-result-copy-btn:hover {
    background: rgba(0, 206, 201, 0.1);
    border-color: rgba(0, 206, 201, 0.3);
    color: var(--accent);
}

/* --- Toast --- */
.movie-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--success);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-modal);
    opacity: 0;
    transition: all var(--transition-base);
    pointer-events: none;
}

.movie-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .movie-search-page {
        padding: var(--space-lg) var(--space-md);
        gap: var(--space-md);
    }

    .movie-search-box {
        flex-direction: column;
    }

    .movie-search-btn {
        justify-content: center;
        padding: 12px;
        border-radius: var(--radius-lg);
        min-height: 44px;
    }

    .movie-search-input {
        font-size: 16px;
        padding: 12px 40px 12px 44px;
    }

    .movie-source-selector {
        flex-wrap: wrap;
        justify-content: stretch;
        width: 100%;
    }

    .movie-source-option {
        flex: 1 1 140px;
        justify-content: center;
        padding: 8px 14px;
        font-size: var(--font-size-xs);
        min-height: 44px;
    }

    .movie-filter-bar {
        gap: 6px;
    }

    .movie-filter-tag {
        padding: 6px 12px;
        font-size: var(--font-size-xs);
        min-height: 36px;
    }

    .movie-result-card {
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-md);
        gap: var(--space-sm);
    }

    .movie-result-info {
        width: 100%;
    }

    .movie-result-icon {
        width: 38px;
        height: 38px;
    }

    .movie-result-icon i {
        width: 18px !important;
        height: 18px !important;
    }

    .movie-result-title {
        font-size: var(--font-size-sm);
    }

    .movie-result-actions {
        flex-direction: row;
        justify-content: flex-end;
        width: 100%;
    }

    .movie-result-link-btn,
    .movie-result-copy-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .movie-state {
        padding: var(--space-xl) var(--space-md);
    }

    .movie-state-icon {
        width: 64px;
        height: 64px;
    }

    .movie-state-icon svg {
        width: 28px;
        height: 28px;
    }

    .movie-state-title {
        font-size: var(--font-size-md);
    }

    .movie-toast {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        font-size: var(--font-size-xs);
        padding: 8px 16px;
        max-width: calc(100vw - 32px);
    }

    .movie-loading-spinner {
        width: 56px;
        height: 56px;
    }

    .movie-welcome-orb {
        width: 100px;
        height: 100px;
    }
}

/* --- Touch Device: Disable hover effects --- */
@media (hover: none) {
    .movie-result-card:hover {
        transform: none;
        box-shadow: none;
        border-color: var(--border-default);
    }

    .movie-source-option:hover {
        transform: none;
        box-shadow: none;
    }

    .movie-search-btn:hover {
        transform: none;
    }

    .movie-result-link-btn:hover,
    .movie-result-copy-btn:hover {
        background: transparent;
        border-color: var(--border-default);
        color: var(--text-secondary);
    }
}

/* --- Responsive: Small Mobile --- */
@media (max-width: 480px) {
    .movie-search-page {
        padding: var(--space-md) var(--space-sm);
    }

    .movie-result-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .movie-filter-tag {
        padding: 5px 10px;
        font-size: 11px;
    }

    .movie-filter-count {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .movie-source-option {
        padding: 6px 12px;
        font-size: 11px;
        gap: 5px;
    }
}

/* ===========================================
   Notes Page
   =========================================== */

.notes-page {
    padding: var(--space-xl);
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 300px;
    gap: var(--space-lg);
    min-height: 100%;
    align-items: start;
    animation: fadeInUp 0.4s ease;
}

.notes-sidebar-panel,
.notes-editor-hero,
.notes-outline-panel,
.notes-inspector-panel,
.notes-doc-empty,
.notes-mobile-nav {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.notes-sidebar-panel,
.notes-inspector-panel,
.notes-editor-panel {
    min-width: 0;
}

.notes-sidebar-panel,
.notes-inspector-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.notes-panel-eyebrow {
    font-size: var(--font-size-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
}

.notes-panel-title,
.notes-inspector-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.notes-panel-subtitle {
    margin-top: 6px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.6;
}

.notes-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
}

.notes-search-box {
    position: relative;
}

.notes-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.notes-doc-search-input {
    padding-left: 40px;
    padding-right: 40px;
}

.notes-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.notes-search-clear:hover {
    background: var(--sidebar-hover-bg);
    color: var(--text-primary);
}

.notes-search-clear svg {
    width: 14px;
    height: 14px;
}

.notes-doc-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.notes-doc-item {
    width: 100%;
    text-align: left;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    border: 1px solid var(--border-default);
    background: rgba(255, 255, 255, 0.02);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.notes-doc-item:hover {
    border-color: var(--border-glow);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.notes-doc-item.active {
    background: rgba(108, 92, 231, 0.12);
    border-color: rgba(108, 92, 231, 0.28);
    box-shadow: var(--shadow-glow);
}

.notes-doc-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: 8px;
}

.notes-doc-name-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.notes-doc-name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.notes-doc-sync-flag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(108, 92, 231, 0.16);
    border: 1px solid rgba(108, 92, 231, 0.24);
    color: var(--primary-light);
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
}

.notes-doc-meta {

    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.notes-doc-excerpt {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notes-doc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
}

.notes-doc-empty-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-subtle);
    color: var(--primary-light);
}

.notes-doc-empty-icon svg {
    width: 20px;
    height: 20px;
}

.notes-doc-empty-title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
}

.notes-doc-empty-desc {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.notes-mobile-list-tip {
    display: none;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(108, 92, 231, 0.18);
    background: rgba(108, 92, 231, 0.08);
    padding: 14px 16px;
}

.notes-mobile-list-tip-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notes-mobile-list-tip p {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.6;
}

.notes-editor-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.notes-mobile-nav {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: 14px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.notes-mobile-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-default);
}

.notes-mobile-back:hover {
    border-color: var(--border-glow);
    background: rgba(108, 92, 231, 0.1);
}

.notes-mobile-back svg {
    width: 16px;
    height: 16px;
}

.notes-mobile-nav-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notes-mobile-nav-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.notes-mobile-nav-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-mobile-save-state {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
}

.notes-mobile-structure-bar {
    display: none;
}

.notes-mobile-structure-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notes-mobile-structure-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.notes-mobile-structure-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-mobile-structure-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.notes-mobile-structure-actions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.notes-mobile-structure-actions::-webkit-scrollbar {
    display: none;
}

.notes-mobile-structure-btn {
    flex: 0 0 auto;
    min-width: 68px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
}

.notes-mobile-structure-btn svg {
    width: 14px;
    height: 14px;
}

.notes-mobile-structure-btn:not(:disabled):hover {
    background: var(--sidebar-hover-bg);
    border-color: var(--border-glow);
}

.notes-mobile-structure-btn:disabled {
    opacity: 0.45;
    color: var(--text-muted);
}

.notes-mobile-structure-btn.is-danger {
    color: #ffb5b3;
}

.notes-mobile-structure-btn.is-danger:not(:disabled):hover {
    color: var(--error);
    background: rgba(255, 118, 117, 0.12);
    border-color: rgba(255, 118, 117, 0.22);
}

.notes-editor-hero {

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-lg);
}

.notes-editor-copy {
    min-width: 0;
    flex: 1;
}

.notes-title-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    line-height: 1.25;
}

.notes-title-input::placeholder {
    color: var(--text-muted);
}

.notes-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: flex-end;
}

.notes-outline-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.notes-outline-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-default);
}

.notes-outline-summary {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.notes-outline-summary-text,
.notes-outline-status {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.notes-outline-summary strong,
.notes-outline-status strong {
    color: var(--text-primary);
}

.notes-outline-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.notes-sync-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
}

.notes-sync-inline[data-sync-state="success"] {
    color: var(--success);
    border-color: rgba(46, 204, 113, 0.28);
    background: rgba(46, 204, 113, 0.08);
}

.notes-sync-inline[data-sync-state="pending"],
.notes-sync-inline[data-sync-state="syncing"] {
    color: var(--primary-light);
    border-color: rgba(108, 92, 231, 0.28);
    background: rgba(108, 92, 231, 0.1);
}

.notes-sync-inline[data-sync-state="error"],
.notes-sync-inline[data-sync-state="offline"] {
    color: var(--error);
    border-color: rgba(255, 118, 117, 0.24);
    background: rgba(255, 118, 117, 0.08);
}


.notes-format-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: rgba(255, 255, 255, 0.04);
}

.notes-format-btn,
.notes-color-picker {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.notes-format-btn:hover,
.notes-color-picker:hover {
    color: var(--text-primary);
    background: var(--sidebar-hover-bg);
}

.notes-format-btn svg,
.notes-color-picker svg {
    width: 16px;
    height: 16px;
}

.notes-color-picker {
    overflow: hidden;
}

.notes-format-color {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.notes-outline-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 320px;
}

.notes-branch-group {
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.035);
    background: rgba(255, 255, 255, 0.008);
    padding: 1px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.notes-branch-group.is-active {
    border-color: rgba(108, 92, 231, 0.16);
    background: rgba(108, 92, 231, 0.035);
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.045);
}




.notes-outline-item {
    position: relative;
    padding-left: calc(var(--notes-level) * 28px);
}

.notes-outline-guides {
    position: absolute;
    left: calc(var(--notes-level) * 28px + 17px);
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: linear-gradient(180deg, rgba(108, 92, 231, 0.24), rgba(108, 92, 231, 0));
    opacity: 0.65;
    pointer-events: none;
}

.notes-outline-item.is-collapsed .notes-toggle-btn:not(.is-placeholder) {
    transform: rotate(90deg);
}

.notes-outline-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.notes-toggle-btn {
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    width: 24px;
    height: 24px;
    margin-top: 4px;
}

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

.notes-toggle-btn.is-placeholder {
    cursor: default;
}

.notes-toggle-btn.is-placeholder:hover {
    background: transparent;
    color: var(--text-secondary);
}

.notes-toggle-btn svg {
    width: 14px;
    height: 14px;
}

.notes-toggle-placeholder {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: rgba(108, 92, 231, 0.22);
}

.notes-item-input {
    min-height: 34px;
    padding: 2px 0;
    outline: none;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    line-height: 1.8;
    word-break: break-word;
    white-space: normal;
}

.notes-item-input:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
}

.notes-item-input strong,
.notes-item-input b {
    font-weight: var(--font-weight-bold);
}

.notes-item-input em,
.notes-item-input i {
    font-style: italic;
}

.notes-item-input u {
    text-decoration: underline;
}

.notes-item-input div,
.notes-item-input p {
    margin: 0;
}

.notes-item-input img {
    display: block;
    max-width: min(100%, 320px);
    max-height: 240px;
    margin-top: 10px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-md);
}


.notes-outline-index {
    position: absolute;
    right: calc(100% + 10px);
    top: 14px;
    font-size: 11px;
    color: var(--text-muted);
}

.notes-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
}

.notes-stat-card {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    background: rgba(108, 92, 231, 0.05);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notes-stat-card.accent {
    background: rgba(0, 206, 201, 0.06);
}

.notes-stat-card-wide {
    grid-column: 1 / -1;
}

.notes-stat-value {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.notes-stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.notes-shortcuts-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    background: rgba(255, 255, 255, 0.02);
    padding: var(--space-md);
}

.notes-shortcuts-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
}

.notes-shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.notes-shortcuts-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.notes-shortcuts-list kbd {
    min-width: 28px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 11px;
    font-family: var(--font-family);
    text-align: center;
}

.notes-shortcuts-tip {
    margin-top: 12px;
    font-size: var(--font-size-xs);
    line-height: 1.6;
    color: var(--text-muted);
}

@media (hover: none) {

    .notes-doc-item:hover,
    .notes-outline-item:hover .notes-outline-row {
        transform: none;
        box-shadow: none;
    }
}


@media (max-width: 1280px) {
    .notes-page {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .notes-inspector-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .notes-page {
        grid-template-columns: 1fr;
    }

    .notes-editor-hero,
    .notes-outline-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .notes-editor-toolbar,
    .notes-outline-toolbar-actions {
        justify-content: flex-start;
    }

    .notes-outline-index {
        display: none;
    }
}

@media (max-width: 768px) {
    .notes-page {
        padding: var(--space-lg) var(--space-md);
        gap: var(--space-md);
    }

    .notes-mobile-nav {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .notes-mobile-list-tip {
        display: block;
    }

    .notes-sidebar-header {
        flex-direction: column;
        align-items: stretch;
    }

    .notes-sidebar-header .btn,
    .notes-editor-toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    .notes-page[data-mobile-view="list"] .notes-editor-panel,
    .notes-page[data-mobile-view="list"] .notes-inspector-panel {
        display: none;
    }

    .notes-page[data-mobile-view="editor"] .notes-sidebar-panel {
        display: none;
    }

    .notes-doc-search-input,
    .notes-title-input,
    .notes-item-input {
        font-size: 16px;
    }

    .notes-title-input {
        line-height: 1.35;
    }

    .notes-item-input {
        line-height: 1.75;
    }

    .notes-editor-hero,
    .notes-inspector-panel,
    .notes-outline-panel {
        border-radius: var(--radius-xl);
    }

    .notes-format-toolbar {
        width: 100%;
        justify-content: flex-start;
    }

    .notes-mobile-structure-bar {
        display: flex;
        position: sticky;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
        z-index: 3;
        gap: 10px;
        padding: 12px;
        border-radius: var(--radius-xl);
        border: 1px solid var(--border-default);
        background: rgba(15, 15, 24, 0.92);
        backdrop-filter: blur(16px);
        box-shadow: var(--shadow-lg);
    }

    .notes-outline-row {
        grid-template-columns: 22px minmax(0, 1fr);
        gap: 8px;
        padding: 10px 12px;
    }

    .notes-outline-item {
        padding-left: calc(var(--notes-level) * 16px);
    }

    .notes-outline-guides {
        left: calc(var(--notes-level) * 16px + 15px);
    }

    .notes-mobile-save-state {
        display: none;
    }
}


@media (max-width: 480px) {
    .notes-page {
        padding: var(--space-md) var(--space-sm);
    }

    .notes-mobile-nav {
        padding: 12px 14px;
    }

    .notes-mobile-back {
        padding: 8px;
    }

    .notes-mobile-back span {
        display: none;
    }

    .notes-doc-item,
    .notes-shortcuts-card,
    .notes-stat-card,
    .notes-mobile-list-tip,
    .notes-branch-group {
        border-radius: var(--radius-md);
    }

    .notes-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .notes-outline-row {
        padding: 8px 10px;
    }

    .notes-title-input {
        font-size: 18px;
    }

    .notes-mobile-structure-bar {
        gap: 8px;
        padding: 10px;
    }

    .notes-mobile-structure-title {
        font-size: 13px;
    }

    .notes-mobile-structure-hint {
        font-size: 11px;
    }

    .notes-mobile-structure-btn {
        min-width: 64px;
        padding: 0 10px;
    }

    .notes-format-btn,
    .notes-color-picker {
        width: 32px;
        height: 32px;
    }

    .notes-mobile-nav-title {
        max-width: 140px;
    }
}







