/* Context AI - Apple-inspired Design */

:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --error-color: #FF3B30;
    --background-color: #F2F2F7;
    --surface-color: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #6D6D80;
    --border-color: #E5E5EA;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.screen {
    min-height: 100vh;
    transition: var(--transition);
}

.hidden {
    display: none !important;
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Social Sign-In Buttons */
.social-signin-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.social-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.social-signin-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
    border-color: #d1d1d6;
}

.social-signin-btn:active {
    transform: translateY(0);
}

.social-signin-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.social-signin-btn.apple {
    background: #000;
    color: white;
    border-color: #000;
}

.social-signin-btn.apple:hover {
    background: #1d1d1f;
    border-color: #1d1d1f;
}

.social-signin-btn.google:hover {
    background: #f8f9fa;
}

.social-signin-btn .btn-icon {
    position: absolute;
    left: 20px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-signin-btn .btn-spinner {
    display: none;
    position: absolute;
    left: 22px;
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.social-signin-btn.loading .btn-icon {
    display: none;
}

.social-signin-btn.loading .btn-spinner {
    display: block;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 16px;
}

.login-container {
    background: var(--surface-color);
    padding: 48px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.logo p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 16px;
}

.value-prop {
    margin-bottom: 24px;
}

.one-thing {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(0, 122, 255, 0.2);
    text-align: center;
    line-height: 1.4;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    background: var(--background-color);
    border-radius: 8px;
    padding: 4px;
}

.tab-button {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.tab-button.active {
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Email Authentication Form */
.email-auth-form {
    margin-top: 24px;
}

.auth-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--background-color);
    border-radius: 10px;
    padding: 4px;
}

.mode-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.mode-btn.active {
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    background: var(--surface-color);
    transition: var(--transition);
    font-family: inherit;
}

.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.auth-form input[type="email"]::placeholder,
.auth-form input[type="password"]::placeholder {
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group input {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--surface-color);
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.primary-button {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.primary-button:hover {
    background: #0056CC;
    transform: translateY(-1px);
}

.primary-button:active {
    transform: translateY(0);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.primary-button.loading {
    pointer-events: none;
}

.primary-button .btn-spinner {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.primary-button.loading .btn-spinner {
    display: block;
}

.primary-button.loading span {
    opacity: 0;
}

.secondary-button {
    padding: 12px 24px;
    background: var(--background-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-button:hover {
    background: var(--surface-color);
    box-shadow: var(--shadow);
}

.error-message {
    color: var(--error-color);
    font-size: 14px;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 59, 48, 0.1);
    display: none;
}

.error-message.show {
    display: block;
}

.trust-signals {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.trust-item:last-child {
    margin-bottom: 0;
}

.trust-icon {
    font-size: 16px;
}

/* Dashboard */
#dashboard-screen {
    background: var(--background-color);
}

/* Enhanced Visual Polish */
.dashboard-header {
    background: var(--surface-color);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-header h1 {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info span {
    color: var(--text-secondary);
    font-size: 13px;
}

.dashboard-content {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    align-items: start;
    min-height: calc(100vh - 100px);
}

/* Enhanced Sidebar Navigation */
.sidebar-nav {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 16px 0;
    position: sticky;
    top: 20px;
    height: fit-content;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
}

.nav-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 16px;
}

.nav-tab-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-align: left;
    width: 100%;
    position: relative;
    margin: 0 6px;
}

.nav-tab-btn:hover {
    background: var(--background-color);
    color: var(--text-primary);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transform: translateX(4px);
}

.nav-tab-btn.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 0 2px 2px 0;
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateY(-50%) translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(-50%) translateX(0);
        opacity: 1;
    }
}

.nav-tab-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-tab-text {
    font-weight: 600;
    flex: 1;
}

/* Main Content Area */
.main-content-area {
    min-height: 0;
    width: 100%;
}

/* Enhanced Content Sections */
.content-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    transition: all 0.3s ease;
}

.content-section:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.content-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 8px;
}

.content-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* Data Sources */
.section-description {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.data-sources {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .data-sources {
        grid-template-columns: 1fr;
    }
}

.source-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
}

.source-card.active {
    border-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.02);
}

.source-card.coming-soon {
    opacity: 0.6;
}

.source-card.clickable {
    cursor: pointer;
    border-color: var(--success-color);
    background: rgba(52, 199, 89, 0.02);
}

.source-card.clickable:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(52, 199, 89, 0.2);
    border-color: var(--success-color);
}

.source-card.clickable .source-status {
    background: var(--success-color);
    color: white;
}

.source-card:hover:not(.coming-soon):not(.clickable) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.source-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.source-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.source-desc {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.3;
}

.source-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.source-card.active .source-status {
    background: var(--primary-color);
    color: white;
}

.source-card.coming-soon .source-status {
    background: var(--border-color);
    color: var(--text-secondary);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.02);
    transform: scale(1.02);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.05);
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.15);
}

.upload-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 16px;
}

.upload-or {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 12px 0;
    font-weight: 500;
}

.upload-btn {
    font-size: 16px;
    font-weight: 600;
    padding: 14px 24px;
    margin: 0 0 12px 0;
}

.upload-note {
    color: var(--text-secondary);
    font-size: 12px;
    font-style: italic;
}

.upload-progress {
    padding: 24px;
}

/* Upload summary card */
.upload-summary-card {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  animation: fadeIn 200ms ease-in;
}
.upload-summary-card .summary-title {
  font-weight: 600;
  margin-bottom: 8px;
}
.upload-summary-card .summary-stats {
  display: flex;
  gap: 16px;
  font-size: 14px;
  margin-bottom: 6px;
}
.upload-summary-card .stat-label { color: #555; margin-right: 4px; }
.upload-summary-card .stat-value { font-weight: 600; }
.upload-summary-card .summary-duplicates { margin-top: 6px; }
.upload-summary-card .dup-title { font-size: 13px; color: #666; margin-bottom: 4px; }
.upload-summary-card .dup-list { margin: 0; padding-left: 18px; font-size: 13px; }
.upload-summary-card.fade-out { opacity: 0; transition: opacity 300ms ease-out; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* Floating toasts (top-right) */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  min-width: 260px;
  max-width: 420px;
  background: #fff;
  color: #111;
  border: 1px solid rgba(0,0,0,0.08);
  border-left: 4px solid #2d7ef7;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast .toast-title { font-weight: 600; margin-bottom: 2px; }
.toast .toast-message { color: #333; }
.toast.success { border-left-color: #34c759; }
.toast.info { border-left-color: #2d7ef7; }
.toast.warn { border-left-color: #ff9f0a; }
.toast.error { border-left-color: #ff3b30; }
.toast .toast-close {
  position: absolute;
  top: 8px;
  right: 10px;
  cursor: pointer;
  color: #888;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

#progress-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Memory Filters */
.memory-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    background: var(--surface-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Memories Grid */
.memories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Enhanced Memory Cards */
.memory-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
}

.memory-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.memory-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.memory-type {
    padding: 4px 8px;
    background: var(--background-color);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.memory-type.episodic {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
}

.memory-type.entity {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.memory-type.fact {
    background: rgba(255, 149, 0, 0.1);
    color: var(--warning-color);
}

.memory-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.memory-content {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.memory-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.no-memories {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 48px;
}

.empty-state {
    text-align: center;
    max-width: 400px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.go-to-upload-btn {
    font-size: 14px;
    padding: 12px 24px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-content {
        grid-template-columns: 220px 1fr;
        gap: 16px;
    }
    
    .sidebar-nav {
        padding: 14px 0;
    }
    
    .nav-tab-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .nav-tab-icon {
        font-size: 15px;
        width: 18px;
    }
}

@media (max-width: 900px) {
    .dashboard-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .sidebar-nav {
        position: relative;
        top: 0;
        order: 1;
    }
    
    .nav-tabs {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 16px;
        gap: 8px;
    }
    
    .nav-tab-btn {
        flex-shrink: 0;
        white-space: nowrap;
        transform: none;
    }
    
    .nav-tab-btn:hover,
    .nav-tab-btn.active {
        transform: none;
    }
    
    .nav-tab-btn.active::before {
        display: none;
    }
    
    .main-content-area {
        order: 2;
    }
    
    .chat-container {
        height: 500px;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .login-container {
        margin: 20px;
        padding: 32px 24px;
    }
    
    .dashboard-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .dashboard-content {
        padding: 20px;
    }
    
    .content-section {
        padding: 20px;
    }
    
    .upload-area {
        padding: 32px 20px;
    }
    
    .memories-grid {
        grid-template-columns: 1fr;
    }
    
    .memory-filters {
        justify-content: center;
    }
    
    .nav-tab-btn {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .nav-tab-icon {
        font-size: 14px;
        width: 18px;
    }
    
    .chat-container {
        height: 450px;
        min-height: 350px;
    }
    
    /* Token field improvements for mobile */
    .token-field {
        flex-direction: column;
        gap: 8px;
    }
    
    .token-input {
        width: 100%;
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .copy-btn {
        align-self: flex-end;
        min-width: 32px;
        height: 32px;
        font-size: 11px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Legacy Dashboard Tabs - Removed in favor of sidebar navigation */

/* MCP Setup Styles */
.section-description {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.5;
}

.mcp-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 122, 255, 0.03);
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-content {
    padding: 20px;
}

.card-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Info Rows */
.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
}

.copyable-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 400px;
}

.copyable-field code {
    background: var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
    flex-shrink: 0;
    min-width: 36px; /* Ensure minimum width for accessibility */
    height: 36px; /* Match input height */
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: #005bb5;
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-icon {
    display: block;
}

/* Token Management */
.token-actions {
    margin-bottom: 24px;
}

.token-display {
    padding: 20px;
    background: rgba(52, 199, 89, 0.05);
    border: 1px solid rgba(52, 199, 89, 0.2);
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden; /* Prevent container overflow */
}

.token-display label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.token-field {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.token-input {
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    background: var(--surface-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}

.token-info {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.token-expires {
    font-weight: 500;
}

/* Instructions */
.instructions-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.instruction-tab-btn {
    padding: 12px 20px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.instruction-content {
    margin-top: 24px;
}

.setup-steps {
    list-style: none;
    padding: 0;
}

.setup-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    counter-increment: step-counter;
}

/* Reset counter for each instruction section to prevent doubling */
.instruction-content {
    counter-reset: step-counter;
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.step-number::before {
    content: counter(step-counter);
}

.step-text {
    flex: 1;
    line-height: 1.6;
    padding-top: 4px;
}

.step-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.step-text a:hover {
    text-decoration: underline;
}

/* Setup Form */
.setup-form {
    background: rgba(247, 247, 247, 0.8);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0 20px 36px; /* Reduced left margin and spacing */
    border: 1px solid var(--border-color);
}

.form-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.form-field:last-child {
    margin-bottom: 0;
}

.form-field label {
    min-width: 140px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-field input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
    background: var(--surface-color);
}

.field-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* Code Blocks */
.code-block {
    background: #2d3748;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0 20px 36px; /* Reduced left margin and spacing */
    position: relative;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-block code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.code-block pre {
    margin: 0;
    white-space: pre;
    line-height: 1.5;
}

.code-block .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 11px;
    padding: 6px 8px;
}

.code-block .copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Enhanced Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    min-height: 500px;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    transition: all 0.3s ease;
}

.chat-container:hover {
    box-shadow: var(--shadow-hover);
}

.chat-container .chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.05), rgba(88, 86, 214, 0.05));
    backdrop-filter: blur(10px);
}

.chat-container .chat-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-container .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-container .chat-input-area {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
}

/* Legacy Chat Panel Styles - Removed in favor of integrated chat section */

.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.chat-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chat-controls {
    display: flex;
    gap: 8px;
}

.chat-control-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--background-color);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chat-control-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeInMessage 0.3s ease-out;
}

.chat-message.user-message {
    align-self: flex-end;
}

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

.message-content {
    background: var(--background-color);
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    word-wrap: break-word;
    position: relative;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 6px;
}

.ai-message .message-content {
    background: var(--background-color);
    border-bottom-left-radius: 6px;
}

.message-content p {
    margin: 0;
    margin-bottom: 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 4px;
}

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

.ai-message .message-time {
    text-align: left;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
    padding: 8px 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0; }

.chat-input-area {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    min-width: 0; /* Allows flex items to shrink below their content size */
}

#chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface-color);
    color: var(--text-primary);
    resize: none;
    transition: var(--transition);
    line-height: 1.4;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

#chat-input::placeholder {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.send-btn:hover:not(:disabled) {
    background: #0056CC;
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.send-icon {
    font-size: 16px;
    transform: rotate(-45deg);
}

.send-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.chat-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 59, 48, 0.1);
    color: var(--error-color);
    border-radius: 8px;
    font-size: 13px;
}

.message-memories {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.memories-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.memory-citation {
    display: inline-block;
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin: 2px 4px 2px 0;
    cursor: help;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Animations */
@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Responsive Design Updates */
@media (max-width: 1200px) {
    .dashboard-content {
        grid-template-columns: 1fr 350px;
        gap: 24px;
    }
    
    .chat-panel {
        height: calc(100vh - 120px);
    }
    
    #chat-input::placeholder {
        font-size: 13px;
    }
}

@media (max-width: 900px) {
    .dashboard-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .chat-panel {
        position: relative;
        top: 0;
        height: 600px;
        order: 2;
    }
}

@media (max-width: 768px) {
    .dashboard-content {
        padding: 20px;
    }
    
    .chat-panel {
        height: 500px;
        min-height: 400px;
    }
    
    .chat-header {
        padding: 16px 20px;
    }
    
    .chat-messages {
        padding: 16px 20px;
    }
    
    .chat-input-area {
        padding: 16px 20px;
    }
    
    .chat-input-container {
        gap: 8px;
    }
    
    #chat-input {
        min-height: 40px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 14px;
    }
    
    #chat-input::placeholder {
        font-size: 13px;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
        border-radius: 20px;
    }
    
    .chat-message {
        max-width: 95%;
    }
}

/* Beta Notice */
.beta-notice {
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.1), rgba(255, 149, 0, 0.05));
    border: 1px solid rgba(255, 149, 0, 0.3);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    text-align: center;
}

.beta-badge {
    background: var(--warning-color);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.beta-description {
    color: var(--text-primary);
    font-size: 14px;
    margin: 0;
    line-height: 1.4;
}

.beta-description strong {
    color: var(--warning-color);
    font-weight: 600;
}

/* ============= MEMORY INPUT MODAL ============= */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    transition: var(--transition);
}

/* Memory Input Modal */
.memory-input-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Modal Header */
.memory-input-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.memory-input-modal .modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.memory-input-modal .close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.memory-input-modal .close-btn:hover {
    background-color: var(--background-color);
}

/* Modal Body */
.memory-input-modal .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background-color: var(--surface-color);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Image Upload Container */
.image-upload-container {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

/* Button Styles */
.primary-btn,
.secondary-btn,
.danger-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: #0051D5;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.primary-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background-color: var(--background-color);
    color: var(--text-primary);
}

.secondary-btn:hover {
    background-color: var(--border-color);
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.danger-btn {
    background-color: var(--error-color);
    color: white;
}

.danger-btn:hover {
    background-color: #D70015;
}

/* Image Preview */
.image-preview {
    margin-top: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background-color: var(--background-color);
}

.image-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 12px;
}

.image-actions {
    display: flex;
    gap: 8px;
}

.image-actions button {
    flex: 1;
}

/* Extracted Text Display */
.extracted-text {
    margin-top: 12px;
    padding: 12px;
    background-color: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.extracted-text h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.extracted-text-content,
.image-description-content {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.image-description-content {
    font-style: italic;
    margin-bottom: 0;
}

/* Modal Footer */
.memory-input-modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.memory-input-modal .modal-footer .primary-btn {
    width: 100%;
}

/* Add Memory Button (will be added to main UI) */
.add-memory-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-hover);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: var(--transition);
    z-index: 100;
}

.add-memory-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 122, 255, 0.4);
}

.add-memory-btn:active {
    transform: scale(0.95);
}

/* ============= CHATGPT UPLOAD MODAL ============= */

.upload-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-width: 640px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border-color);
    backdrop-filter: saturate(120%) blur(8px);
    animation: fadeIn 220ms ease-out;
}

.upload-modal .modal-body {
    padding: 36px 40px;
}

.upload-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(0,122,255,0.05), rgba(88,86,214,0.05));
}

.upload-modal .modal-header h2 {
    font-size: 18px;
    margin: 0;
}

.upload-modal .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.upload-modal .close-btn:hover { background: var(--background-color); }

.upload-modal-content {
    text-align: center;
}

.upload-modal .upload-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.upload-modal p {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-modal .upload-or {
    margin: 16px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-modal .upload-btn {
    margin: 16px 0;
}

.upload-modal .upload-note {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Drag-and-drop target styling */
.upload-modal .upload-modal-content {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 28px 16px;
    background: rgba(255,255,255,0.6);
    transition: var(--transition);
}

.upload-modal .upload-modal-content:hover {
    border-color: var(--primary-color);
    background: rgba(0,122,255,0.03);
}

.upload-modal .upload-modal-content.dragover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(0,122,255,0.18);
    transform: translateY(-1px);
}

/* Progress area polish */
#chatgpt-upload-progress .progress-bar { height: 10px; border-radius: 6px; }
#chatgpt-upload-progress .progress-fill { border-radius: 6px; }
#chatgpt-progress-text { color: var(--text-secondary); font-weight: 500; }

/* Mobile tweaks */
@media (max-width: 600px) {
    .upload-modal { width: 95%; max-width: 560px; border-radius: 14px; }
    .upload-modal .modal-body { padding: 24px 16px; }
    .upload-modal .upload-icon { font-size: 54px; }
}

/* ============= INLINE MEMORY FORMS ============= */

.memory-input-inline {
    text-align: center;
}

.memory-input-inline .upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.memory-input-inline p {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.inline-form {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

.inline-input,
.inline-textarea,
.inline-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background-color: var(--surface-color);
}

.inline-input:focus,
.inline-textarea:focus,
.inline-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.inline-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.image-upload-section {
    text-align: center;
    margin-bottom: 20px;
}

.image-upload-section .secondary-button {
    margin-bottom: 8px;
}

.image-preview-inline {
    margin: 20px 0;
    padding: 16px;
    background: var(--background-color);
    border-radius: 8px;
    text-align: center;
}

.image-preview-inline img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.extracted-text-inline {
    margin: 16px 0;
    padding: 16px;
    background: rgba(0, 122, 255, 0.05);
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 8px;
}

.extracted-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.extracted-content {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .memory-input-modal {
        width: 95%;
        max-height: 95vh;
    }

    .memory-input-modal .modal-header,
    .memory-input-modal .modal-body,
    .memory-input-modal .modal-footer {
        padding: 16px;
    }

    .add-memory-btn {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
}
/* ==========================================
   SUBSCRIPTION UI STYLES
   ========================================== */

.subscription-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-right: 20px;
}

/* Tier Badge */
.tier-badge {
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: capitalize;
    transition: all 0.2s ease;
}

.tier-badge.tier-free {
    background: #e5e5ea;
    color: #6e6e73;
}

.tier-badge.tier-starter {
    background: linear-gradient(135deg, #34c759 0%, #30d158 100%);
    color: white;
}

.tier-badge.tier-pro {
    background: linear-gradient(135deg, #007aff 0%, #0051d5 100%);
    color: white;
}

.tier-badge.tier-ultimate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Memory Usage */
.memory-usage-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 100px;
}

.memory-usage-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.memory-usage-bar-bg {
    width: 100%;
    height: 6px;
    background: #e5e5ea;
    border-radius: 3px;
    overflow: hidden;
}

.memory-usage-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
}

/* Upgrade Button */
.upgrade-button {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upgrade-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Manage Billing Button */
.manage-billing-button {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-color);
    background: white;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.manage-billing-button:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive Subscription UI */
@media (max-width: 968px) {
    .subscription-info {
        flex-wrap: wrap;
        gap: 12px;
    }

    .memory-usage-container {
        min-width: 80px;
    }

    .upgrade-button,
    .manage-billing-button {
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 768px) {
    .subscription-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-right: 12px;
    }

    .memory-usage-container {
        width: 100%;
    }

    .upgrade-button,
    .manage-billing-button {
        width: 100%;
    }
}
