/* =================================
   LAYOUT.CSS - Structure & Components
   Consistent layout across all pages
   ================================= */


/* ==================
   CONTAINERS
   ================== */

.container {
    width: 100%;
    max-width: var(--max-width-base);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.container-narrow {
    max-width: var(--max-width-narrow);
}

.container-wide {
    max-width: var(--max-width-wide);
}


/* ==================
   NAVIGATION
   ================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.site-header.scrolled {
    box-shadow: var(--shadow-sm);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 var(--space-4);
}


/* Logo/Name */

.site-logo {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.01em;
    transition: color var(--transition-fast);
}

.site-logo:hover {
    color: var(--accent-color);
}


/* Desktop Navigation */

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
    position: relative;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--accent-color);
}

.nav-link.active {
    color: var(--accent-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-color);
}


/* Mobile Menu Toggle */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    z-index: 60;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--primary-color);
    margin: 5px 0;
    transition: all var(--transition-base);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}


/* Mobile Navigation */

@media (max-width: 767px) {
    .mobile-menu-toggle {
        display: block;
    }
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background-color: var(--bg-white);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--space-4);
        border-bottom: 1px solid var(--border-light);
        box-shadow: var(--shadow-md);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    .nav-link {
        padding: var(--space-3) var(--space-4);
        border-bottom: 1px solid var(--border-light);
    }
    .nav-link:last-child {
        border-bottom: none;
    }
    .nav-link.active::after {
        display: none;
    }
    .nav-link.active {
        background-color: var(--bg-subtle);
    }
}


/* ==================
   MAIN CONTENT AREA
   ================== */

.main-content {
    min-height: calc(100vh - 70px);
    padding-top: 70px;
    /* Height of fixed header */
}


/* ==================
   PAGE SECTIONS
   ================== */

.section {
    padding: var(--space-16) 0;
}

.section-header {
    margin-bottom: var(--space-12);
}

.section-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--space-3);
    line-height: var(--leading-tight);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-light);
    max-width: var(--max-width-narrow);
}


/* Section with background */

.section-alt {
    background-color: var(--bg-light);
}


/* ==================
   PAGE HERO/HEADER
   ================== */

.page-hero {
    padding: var(--space-20) 0 var(--space-16) 0;
    background-color: var(--bg-white);
}

.page-title {
    font-size: var(--text-5xl);
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--space-4);
    line-height: var(--leading-tight);
}

.page-description {
    font-size: var(--text-xl);
    color: var(--text-light);
    max-width: var(--max-width-narrow);
    line-height: var(--leading-relaxed);
}


/* ==================
   CONTENT SECTIONS
   ================== */


/* Simple list layout (for publications, presentations, etc.) */

.content-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.content-list-item {
    padding: var(--space-6) 0;
    border-bottom: 1px solid var(--border-light);
}

.content-list-item:first-child {
    padding-top: 0;
}

.content-list-item:last-child {
    border-bottom: none;
}


/* Item header (title, date, etc.) */

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

.item-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--primary-color);
    line-height: var(--leading-tight);
}

.item-meta {
    font-size: var(--text-sm);
    color: var(--text-light);
    white-space: nowrap;
}


/* Item content */

.item-content {
    margin-bottom: var(--space-3);
}

.item-description {
    color: var(--text-color);
    line-height: var(--leading-relaxed);
}


/* Item links/actions */

.item-links {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.item-link {
    font-size: var(--text-sm);
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.item-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}


/* ==================
   TWO-COLUMN LAYOUT
   ================== */

.two-column {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-12);
}

@media (min-width: 768px) {
    .two-column {
        grid-template-columns: 1fr 1fr;
    }
}


/* ==================
   THREE-COLUMN LAYOUT
   ================== */

.three-column {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

@media (min-width: 640px) {
    .three-column {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .three-column {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* ==================
   SIDEBAR LAYOUT
   ================== */

.sidebar-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-12);
}

@media (min-width: 1024px) {
    .sidebar-layout {
        grid-template-columns: 2fr 1fr;
    }
}

.sidebar {
    background-color: var(--bg-light);
    padding: var(--space-6);
    border-radius: var(--radius-base);
}


/* ==================
   FOOTER
   ================== */

.site-footer {
    background-color: var(--bg-subtle);
    border-top: 1px solid var(--border-light);
    padding: var(--space-12) 0;
    margin-top: var(--space-20);
}

.footer-content {
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    flex-wrap: wrap;
    list-style: none;
    margin: 0 0 var(--space-6) 0;
    padding: 0;
}

.footer-nav a {
    font-size: var(--text-sm);
    color: var(--text-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-nav a:hover {
    color: var(--accent-color);
}

.footer-text {
    font-size: var(--text-sm);
    color: var(--text-light);
    margin: 0;
}


/* ==================
   TAGS & BADGES
   ================== */

.tag-list {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-3);
}

.tag {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-light);
    background-color: var(--bg-subtle);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background-color: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background-color: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
}

.badge-info {
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--info-color);
}


/* ==================
   TIMELINE (for CV/Experience)
   ================== */

.timeline {
    position: relative;
    padding-left: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-8);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -34px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-color);
    border: 2px solid var(--bg-white);
}

.timeline-date {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: var(--space-2);
}

.timeline-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--space-2);
}

.timeline-content {
    color: var(--text-color);
    line-height: var(--leading-relaxed);
}


/* ==================
   PROFILE SECTION (for Home page)
   ================== */

.profile-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-12);
    align-items: start;
}

@media (min-width: 768px) {
    .profile-section {
        grid-template-columns: 300px 1fr;
    }
}

.profile-image-wrapper {
    text-align: center;
}

.profile-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: var(--radius-base);
}

.profile-info h1 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-3);
}

.profile-subtitle {
    font-size: var(--text-xl);
    color: var(--text-light);
    margin-bottom: var(--space-6);
}

.profile-links {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-top: var(--space-6);
}


/* ==================
   STATS/METRICS
   ================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-6);
}

.stat-item {
    text-align: center;
    padding: var(--space-6);
}

.stat-number {
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1;
    margin-bottom: var(--space-2);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


/* ==================
   LOADING STATES
   ================== */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-12);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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


/* ==================
   RESPONSIVE UTILITIES
   ================== */


/* Hide on mobile */

@media (max-width: 639px) {
    .hide-mobile {
        display: none !important;
    }
}


/* Hide on tablet */

@media (min-width: 640px) and (max-width: 1023px) {
    .hide-tablet {
        display: none !important;
    }
}


/* Hide on desktop */

@media (min-width: 1024px) {
    .hide-desktop {
        display: none !important;
    }
}


/* Show only on mobile */

.show-mobile {
    display: block;
}

@media (min-width: 640px) {
    .show-mobile {
        display: none !important;
    }
}


/* ==================
   ANIMATIONS
   ================== */

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

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


/* ==================
   RESPONSIVE TYPOGRAPHY
   ================== */

@media (max-width: 639px) {
    .page-title {
        font-size: var(--text-3xl);
    }
    .section-title {
        font-size: var(--text-2xl);
    }
    h1 {
        font-size: var(--text-3xl);
    }
    h2 {
        font-size: var(--text-2xl);
    }
}


/* ==================
   RESPONSIVE SPACING
   ================== */

@media (max-width: 639px) {
    .section {
        padding: var(--space-12) 0;
    }
    .page-hero {
        padding: var(--space-12) 0 var(--space-8) 0;
    }
    .section-header {
        margin-bottom: var(--space-8);
    }
}


/* =================================
   LAYOUT.CSS MOBILE FIX
   Fix for hamburger menu positioning in mobile view
   ================================= */


/* Mobile Navigation - FIXED VERSION */

@media (max-width: 767px) {
    /* Ensure nav-container maintains proper flex layout */
    .nav-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0 var(--space-4);
    }
    /* Make sure logo stays on the left */
    .site-logo {
        flex-shrink: 0;
    }
    /* Ensure hamburger stays on the right */
    .mobile-menu-toggle {
        display: block;
        margin-left: auto;
        /* This pushes it to the right */
        flex-shrink: 0;
    }
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background-color: var(--bg-white);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--space-4);
        border-bottom: 1px solid var(--border-light);
        box-shadow: var(--shadow-md);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    .nav-link {
        padding: var(--space-3) var(--space-4);
        border-bottom: 1px solid var(--border-light);
    }
    .nav-link:last-child {
        border-bottom: none;
    }
    .nav-link.active::after {
        display: none;
    }
    .nav-link.active {
        background-color: var(--bg-subtle);
    }
}