/* Enable scrolling for this page */
body.memory-page {
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
}

body.memory-page #app {
    height: auto;
    min-height: 100vh;
}

/* Memory Page Styles */

.memory-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 80px;
}

/* Header */
.memory-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.header-icon {
    font-size: 1.5rem;
}

.header-subtitle {
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-size: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Stats Cards */
.memory-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-elevated);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-subtle);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-subtle);
    border-radius: 10px;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Quick Facts */
.quick-facts {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.quick-facts h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.fact-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fact-key {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent-primary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.fact-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.fact-placeholder {
    color: var(--text-muted);
    font-style: italic;
    grid-column: 1 / -1;
    text-align: center;
    padding: 1rem;
}

/* Tabs */
.memory-tabs-container {
    background: var(--surface-elevated);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.tabs-header {
    display: flex;
    gap: 0.25rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--surface-subtle);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: var(--text-primary);
}

/* Search */
.memory-search {
    display: flex;
    padding: 1rem;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.memory-search input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--surface-subtle);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.memory-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-btn {
    padding: 0.75rem 1rem;
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-btn:hover {
    background: var(--accent-primary-hover);
}

/* Memory List */
.memory-list {
    padding: 1rem;
    min-height: 300px;
}

.memory-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    background: var(--surface-subtle);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.memory-item:hover {
    border-color: var(--border-subtle);
    transform: translateX(4px);
}

.memory-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.memory-type-icon.fact { background: rgba(59, 130, 246, 0.2); }
.memory-type-icon.person { background: rgba(236, 72, 153, 0.2); }
.memory-type-icon.emotion { background: rgba(239, 68, 68, 0.2); }
.memory-type-icon.goal { background: rgba(34, 197, 94, 0.2); }
.memory-type-icon.insight { background: rgba(168, 85, 247, 0.2); }
.memory-type-icon.preference { background: rgba(249, 115, 22, 0.2); }
.memory-type-icon.healing { background: rgba(20, 184, 166, 0.2); }

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

.memory-key {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent-primary);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.memory-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
}

.memory-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.memory-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.memory-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.memory-item:hover .memory-actions {
    opacity: 1;
}

.memory-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--surface-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.memory-action-btn:hover {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.memory-action-btn.delete:hover {
    background: var(--danger);
}

/* Importance Badges */
.importance-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.importance-badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.importance-badge.high {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
}

.importance-badge.medium {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.importance-badge.low {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface-elevated);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

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

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

/* Form Styles */
.form-group {
    padding: 0 1.25rem;
    margin-bottom: 1rem;
}

.form-group:first-of-type {
    padding-top: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--surface-subtle);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

/* Buttons */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: var(--surface-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: var(--surface-elevated);
}

.btn-danger {
    padding: 0.75rem 1.5rem;
    background: var(--danger);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 300px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    .memory-main {
        padding: 1rem;
        padding-top: 70px;
    }

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

    .header-actions {
        justify-content: flex-end;
    }

    .tabs-header {
        padding: 0.75rem;
    }

    .tab-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .memory-item {
        padding: 0.75rem;
    }

    .memory-actions {
        opacity: 1;
        flex-direction: column;
    }

    .fab {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}
