/**
 * Memory Page Styles
 * Production-grade, distinctive design for memory management
 * Version: 1.0.0
 */

/* ============================================
   Memory Container & Layout
   ============================================ */

.memory-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Memory Header
   ============================================ */

.memory-header {
    margin-bottom: 2.5rem;
}

.memory-intro {
    margin-bottom: 2rem;
}

.memory-intro h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2a6b9d;
    margin-bottom: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

.memory-intro p {
    font-size: 1rem;
    color: #666;
    line-height: 1.6;
    max-width: 700px;
}

/* ============================================
   Memory Stats Card
   ============================================ */

.memory-stats-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.memory-stat {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e0e6ed;
    border-radius: 16px;
    padding: 1.75rem;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.memory-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: #4e81bc;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #4e81bc 0%, #2a6b9d 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(78, 129, 188, 0.3);
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2a6b9d;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

.stat-bar {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4e81bc 0%, #6490d3 100%);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(78, 129, 188, 0.4);
}

/* ============================================
   Memory Full Banner
   ============================================ */

.memory-full-banner {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    border: 2px solid #ff6b6b;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: slideDown 0.4s ease;
}

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

.banner-icon {
    width: 40px;
    height: 40px;
    background: #ff6b6b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.banner-content h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #c92a2a;
    margin-bottom: 0.25rem;
}

.banner-content p {
    font-size: 0.875rem;
    color: #e03131;
    margin: 0;
}

/* ============================================
   Action Bar
   ============================================ */

.memory-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    font-size: 0.875rem;
}

.search-box input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    background: white;
}

.search-box input:focus {
    outline: none;
    border-color: #4e81bc;
    box-shadow: 0 0 0 3px rgba(78, 129, 188, 0.1);
}

.search-box input::placeholder {
    color: #adb5bd;
}

.btn-add-memory {
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, #4e81bc 0%, #2a6b9d 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(78, 129, 188, 0.3);
}

.btn-add-memory:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(78, 129, 188, 0.4);
}

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

/* ============================================
   Memory List
   ============================================ */

.memory-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Loading State */
.memory-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.memory-loading i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #4e81bc;
}

.memory-loading p {
    font-size: 1rem;
    margin: 0;
}

/* Empty State */
.memory-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #d2c4e4 0%, #a4b6e5 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #4e81bc;
    margin-bottom: 1.5rem;
}

.memory-empty h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2a6b9d;
    margin-bottom: 0.75rem;
}

.memory-empty p {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 2rem;
    max-width: 500px;
    line-height: 1.6;
}

/* Memory Item */
.memory-item {
    background: white;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.memory-item:hover {
    border-color: #4e81bc;
    box-shadow: 0 4px 16px rgba(78, 129, 188, 0.12);
    transform: translateX(4px);
}

.memory-content {
    flex: 1;
}

.memory-text {
    font-size: 1rem;
    color: #212529;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    word-wrap: break-word;
}

.memory-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.memory-date,
.memory-words {
    font-size: 0.8125rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.memory-date i,
.memory-words i {
    font-size: 0.75rem;
}

.memory-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    background: white;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-icon:hover {
    background: #f8f9fa;
    border-color: #4e81bc;
    color: #4e81bc;
    transform: scale(1.1);
}

.btn-icon.delete-btn:hover {
    background: #fff5f5;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* ============================================
   Modal Styles
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
    animation: fadeInModal 0.3s ease;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content.memory-modal {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInModal 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header {
    padding: 1.75rem 2rem;
    border-bottom: 2px solid #e0e6ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #2a6b9d;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    background: white;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.125rem;
}

.modal-close:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
}

.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: #4e81bc;
    box-shadow: 0 0 0 3px rgba(78, 129, 188, 0.1);
}

.input-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.hint-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.word-count {
    font-weight: 600;
    color: #4e81bc;
    background: #e8f0f8;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
}

.hint-right {
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Memory Examples */
.memory-examples {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.examples-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.examples-header i {
    color: #ffa726;
}

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

.example-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.example-item.good {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.example-item.bad {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.example-item i {
    font-size: 0.75rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 2px solid #e0e6ed;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4e81bc 0%, #2a6b9d 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(78, 129, 188, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(78, 129, 188, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #6c757d;
    border: 2px solid #e0e6ed;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* ============================================
   Notifications
   ============================================ */

.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    z-index: 10001;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.error-notification {
    border-left: 4px solid #ff6b6b;
    color: #c92a2a;
}

.error-notification i {
    color: #ff6b6b;
    font-size: 1.125rem;
}

.success-notification {
    border-left: 4px solid #51cf66;
    color: #2b8a3e;
}

.success-notification i {
    color: #51cf66;
    font-size: 1.125rem;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .memory-container {
        padding: 1rem;
    }

    .memory-intro h3 {
        font-size: 1.5rem;
    }

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

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

    .search-box {
        max-width: 100%;
    }

    .btn-add-memory {
        width: 100%;
        justify-content: center;
    }

    .memory-item {
        flex-direction: column;
    }

    .memory-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .modal-content.memory-modal {
        margin: 1rem;
    }

    .modal-header {
        padding: 1.25rem 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .notification {
        right: 1rem;
        left: 1rem;
    }
}
