/* This file is now located at css/styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-width: 280px;
    --sidebar-collapsed: 80px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%; /* Ensure html and body take full height for flexbox to work */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    overflow-wrap: break-word; /* Prevents long words from overflowing */
    min-height: 100vh; /* Ensure body takes at least full viewport height */
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(145deg, var(--surface) 0%, var(--background) 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); opacity: 0; }
    50% { transform: translate(-50%, -50%) rotate(180deg); opacity: 1; }
}

/* Styles for the app icon container within the logo */
.sidebar-header .logo #appIconContainer {
    display: flex; /* To center the icon/image */
    align-items: center;
    justify-content: center;
    width: 1.75rem; /* Match font-size from old .logo i */
    height: 1.75rem; /* Match font-size from old .logo i */
    overflow: hidden; /* Important for image scaling */
}

.sidebar-header .logo #appIconContainer i {
    font-size: 1.75rem; /* Apply original size to dynamic Font Awesome icon */
    background: linear-gradient(45deg, #ffffff, #e0f2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    display: block; /* Ensure it respects width/height for centering */
}

.sidebar-header .logo #appIconContainer img {
    width: 100%; /* Fill container */
    height: 100%; /* Fill container */
    object-fit: contain; /* Ensure aspect ratio is maintained without cropping */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    position: relative;
    z-index: 2;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.nav-item {
    position: relative;
    margin: 0.25rem 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    user-select: none;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    opacity: 0;
    transition: var(--transition);
    z-index: 0;
}

.nav-item:hover::before {
    opacity: 0.08;
}

.nav-item.active::before {
    opacity: 0.12;
}

.nav-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1) 0%, rgba(var(--accent-rgb), 0.1) 100%);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    transform: translateX(4px);
}

.nav-icon {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.nav-icon i {
    font-size: 1.125rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-item:hover .nav-icon i,
.nav-item.active .nav-icon i {
    color: var(--primary);
    transform: scale(1.1);
}

.nav-text {
    position: relative;
    z-index: 1;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
    flex: 1;
}

.nav-item:hover .nav-text,
.nav-item.active .nav-text {
    color: var(--primary);
    font-weight: 600;
}

.nav-badge {
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, var(--error) 0%, #fca5a5 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
    min-width: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.nav-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
    border-radius: 2px;
    transition: var(--transition);
}

.nav-item.active .nav-indicator {
    height: 24px;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.logout {
    color: var(--error);
    margin: 0;
}

.logout:hover {
    background: rgba(var(--error-rgb), 0.1);
    border-color: rgba(var(--error-rgb), 0.2);
}

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    width: 48px;
    height: 48px;
    
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
}

.mobile-menu-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.mobile-menu-btn i {
    font-size: 1.25rem;
    transition: var(--transition);
}

.mobile-menu-btn:hover i {
    transform: rotate(180deg);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.theme-toggle i {
    color: white;
    font-size: 1rem;
    transition: var(--transition);
}

.theme-toggle:hover i {
    transform: rotate(180deg);
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.content-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.view-content {
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.5s ease-out;
    flex-grow: 1;
}

.view-content.active {
    display: flex;
}

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

.view-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.view-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.view-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.content-dynamic {
    flex-grow: 1;
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.content-dynamic.loading {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.content-dynamic {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease; 
    opacity: 0; 
}

.mobile-overlay.active {
    display: block; 
    opacity: 1; 
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        max-width: 320px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .content-container {
        padding: 1rem;
        padding-top: 5rem;
    }

    .view-header h1 {
        font-size: 1.875rem;
    }

    .view-header p {
        font-size: 1rem;
    }

    .content-dynamic {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .content-container {
        padding: 0.75rem;
        padding-top: 4.5rem;
    }

    .view-header {
        margin-bottom: 1.5rem;
    }

    .view-header h1 {
        font-size: 1.625rem;
    }
}

html {
    scroll-behavior: smooth;
}

.nav-item:focus,
.mobile-menu-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* These data-theme specific styles are now mostly redundant if variables are correctly applied at :root */
/* However, they can be used for specific overrides if gradients/shimmers need different values */
[data-theme="dark"] .sidebar {
    background: linear-gradient(145deg, var(--surface) 0%, var(--background) 100%);
}

[data-theme="dark"] .sidebar-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

/* Dark theme adjustments for the app logo icon/image */
[data-theme="dark"] .sidebar-header .logo #appIconContainer i {
    background: linear-gradient(45deg, #ffffff, #dbeafe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .logo h2 {
    color: #ffffff;
}

[data-theme="dark"] .nav-text,
[data-theme="dark"] .nav-icon i {
    color: var(--text-primary);
}

/* Artefact Home Styles */
/* These styles are now mostly superseded by home-artefact.css for detailed home sections */
.home-artefact {
    padding: 1rem 0;
}

.home-section {
    margin-bottom: 3rem;
}

.home-section h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.75rem;
    display: inline-block;
}

.home-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.home-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.home-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.home-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.home-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.home-card-content h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.home-card-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .home-section h2 {
        font-size: 1.5rem;
    }
    .home-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Artefact Card Styles */
.card-artefact {
    padding: 1rem 0;
    position: relative;
}

.back-button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.back-button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.back-button i {
    font-size: 1rem;
}

.card-detail-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card-detail-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.card-detail-title {
    font-size: 2.25rem;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-detail-short-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-style: italic;
}

.card-detail-long-description {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.7;
}

.card-detail-html-content {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.card-detail-html-content h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.card-detail-html-content ul {
    list-style-position: inside;
    margin-left: 1rem;
}

.card-detail-html-content li {
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .card-detail-title {
        font-size: 1.875rem;
    }
    .card-detail-content {
        padding: 1.5rem;
    }
}