/*
CHANGE LOG
File: /static/css/ms.css
Document Type: CSS Stylesheet
Purpose: Complete Memory System styling with sidebar navigation and hero image overlay
Main App: nsgia_app.py
Blueprint: auth_blueprint.py
Routes: /
Context: Clean Memory System styling with 80vh hero, sidebar navigation, and text overlay
HTML Templates: ai_index.html
Dependencies: None (standalone)
Version History:
2025-09-23 v1.0 - Clean Memory System CSS with ms- classes only
*/

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #f8f9fa;
    scroll-behavior: smooth;
}

/* Main Container */
.ms-main-container {
    min-height: 100vh;
}

/* Sidebar Navigation */
.ms-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 20px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.ms-sidebar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.ms-sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.ms-sidebar-header p {
    margin: 5px 0 0 0;
    font-size: 12px;
    opacity: 0.8;
    color: rgba(255,255,255,0.8);
}

.ms-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ms-sidebar li {
    margin-bottom: 8px;
}

.ms-sidebar a {
    display: block;
    padding: 12px 15px;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.ms-sidebar a:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateX(5px);
    text-decoration: none;
}

.ms-sidebar a.active {
    background-color: rgba(255,255,255,0.15);
    border-left-color: #81a1c1;
}

/* Main Content Area - positioned after sidebar */
main {
    margin-left: 280px;
    min-height: 100vh;
}

/* Hero Section - 90vh with text overlay to show full image */
.ms-hero {
    position: relative;
    height: 90vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ms-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.ms-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.ms-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.5) 100%
    );
    z-index: 2;
}

.ms-hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
    max-width: 800px;
    padding: 2rem;
}

.ms-hero-content h1 {
    font-size: 3.5rem;
    font-weight: 900;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 1rem;
    line-height: 1.1;
}

.ms-hero-byline {
    font-size: 1.3rem;
    font-weight: 500;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.95);
}

.ms-hero-subtitle {
    font-size: 1.2rem;
    font-style: italic;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    line-height: 1.4;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.9);
}

/* CTA Button */
.ms-primary-cta {
    display: inline-block;
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    color: white;
    padding: 16px 32px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1rem;
}

.ms-primary-cta:hover {
    background: linear-gradient(135deg, #2c5aa0 0%, #2a5298 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(49, 130, 206, 0.4);
    text-decoration: none;
    color: white;
}

/* Secondary Links */
.ms-secondary-links {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.ms-link-muted {
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
    text-decoration: none;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.ms-link-muted:hover {
    color: rgba(255,255,255,1);
    text-decoration: none;
}

.ms-separator {
    color: rgba(255,255,255,0.6);
}

/* Content Sections */
.ms-content {
    padding: 60px 40px;
    margin-bottom: 80px; /* Add space for footer */
}

.ms-content h2 {
    color: #4a5568;
    font-size: 2.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 50px;
}

.ms-answer-section {
    background: white;
    padding: 40px;
    margin-bottom: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    scroll-margin-top: 20px;
}

.ms-answer-section h2 {
    color: #4a5568;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: left;
}

.ms-answer-section h3 {
    color: #4a5568;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 30px 0 15px 0;
}

.ms-answer-section p {
    color: #4a5568;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

.ms-answer-section ul {
    color: #4a5568;
    margin-left: 20px;
    margin-bottom: 20px;
}

.ms-answer-section ul li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.ms-answer-section ul li strong {
    color: #2d3748;
    font-weight: 600;
}

/* Back to Top */
.ms-back-top {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.ms-back-link {
    color: #3182ce;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.ms-back-link:hover {
    color: #2c5aa0;
    text-decoration: none;
}

/* Back to Top Button */
.ms-back-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
}

.ms-back-top-btn.show {
    opacity: 1;
    visibility: visible;
}

.ms-back-top-btn:hover {
    background: linear-gradient(135deg, #2c5aa0 0%, #2a5298 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(49, 130, 206, 0.4);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ms-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px;
    }
    
    .ms-sidebar.open {
        transform: translateX(0);
    }
    
    main {
        margin-left: 0;
    }
    
    .ms-hero {
        height: 70vh;
    }
    
    .ms-hero-content h1 {
        font-size: 2.5rem;
    }
    
    .ms-hero-content {
        padding: 1rem;
    }
    
    .ms-content {
        padding: 40px 20px;
    }
    
    .ms-answer-section {
        padding: 24px;
    }
    
    .ms-two-column {
        flex-direction: column;
        gap: 20px;
    }
    
    .ms-column-image {
        width: 100%;
        text-align: center;
    }
    
    .ms-section-image {
        width: 200px;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .ms-hero {
        height: 60vh;
    }
    
    .ms-hero-content h1 {
        font-size: 2rem;
    }
    
    .ms-hero-byline {
        font-size: 1.1rem;
    }
    
    .ms-hero-subtitle {
        font-size: 1rem;
    }
    
    .ms-content {
        padding: 30px 15px;
    }
}


/* =========================
   Stable Table Layout
   ========================= */
.ms-section-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

.ms-image-col {
    width: 220px;
    padding-right: 20px;
    vertical-align: top;
}

.ms-text-col {
    vertical-align: top;
}

/* =========================
   Expandable Images
   ========================= */
.ms-expandable {
    width: 200px;
    cursor: pointer;
    border-radius: 6px;
    transition: transform 0.2s ease;
}
.ms-expandable:hover {
    transform: scale(1.05);
}

/* Modal for image preview */
.ms-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
}
.ms-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
}
.ms-close {
    position: absolute;
    top: 20px;
    right: 35px;
    font-size: 40px;
    color: white;
    cursor: pointer;
}

/* =========================
   Hero Fix
   ========================= */
.ms-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}


/* Table Layout for Partials */
.ms-col-image {
    width: 220px;
    padding-right: 20px;
    vertical-align: top;
}
.ms-col-content {
    vertical-align: top;
}
.ms-col-image img {
    width: 200px;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.ms-col-image img:hover {
    transform: scale(1.03);
}

/* Modal for Image Expansion */
#ms-image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    padding: 20px;
}
#ms-image-modal img {
    max-width: 95%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
#ms-modal-close {
    position: absolute;
    top: 20px; right: 30px;
    font-size: 40px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    user-select: none;
}
#ms-modal-close:hover {
    color: #ddd;
}
