/* =========================================
   1. CORE VARIABLES & RESET
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #000;
    --secondary: #333;
    --light: #666;
    --lighter: #999;
    --white: #fff;
    --bg-light: #f8f8f8;
    --accent: #0066ff;
    --success: #10b981;
    --max-width: 1200px; /* Portfolio width */
    --vocab-max-width: 1400px; /* Wider for tables */
    --nav-height: 60px;
    --sidebar-width: 280px;
}

/* =========================================
   2. BASE STYLES
   ========================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--primary);
    background: var(--bg-light);
    overflow-x: hidden;
}

/* =========================================
   3. NAVIGATION (Shared)
   ========================================= */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid #eee;
    height: var(--nav-height);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--light);
    font-size: 0.95rem;
    transition: color 0.3s;
    position: relative;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

/* Menu Toggle (Mobile) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

/* =========================================
   4. VOCABULARY PAGE SPECIFIC STYLES
   ========================================= */

/* Main Layout for Vocab Page */
.main-layout {
    display: flex;
    margin-top: var(--nav-height);
    min-height: calc(100vh - var(--nav-height));
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid #e5e7eb;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    padding: 2rem 0;
    scroll-behavior: smooth;
    z-index: 900;
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: #f1f1f1; }
.sidebar::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }

.sidebar-header {
    padding: 0 1.5rem 1rem;
    border-bottom: 2px solid var(--accent);
    margin-bottom: 1.5rem;
}

.sidebar-header h2 { font-size: 1.3rem; color: var(--primary); }
.sidebar-header p { color: var(--light); font-size: 0.9rem; margin-top: 0.5rem; }

/* Sidebar Search & Sort */
.search-box { padding: 0 1.5rem 1rem; margin-bottom: 0.5rem; }
.search-box input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.9rem;
}
.search-box input:focus { outline: none; border-color: var(--accent); }

.sort-toggle { padding: 0 1.5rem 1rem; margin-bottom: 0.5rem; }
.sort-toggle label { display: block; margin-bottom: 0.5rem; color: var(--light); font-size: 0.85rem; font-weight: 500; }
.sort-buttons { display: flex; gap: 0.5rem; }

.sort-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    background-color: var(--white);
    color: var(--secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.sort-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.sort-btn.active { background-color: var(--accent); color: var(--white); border-color: var(--accent); }

/* Sidebar Lists */
.vocab-category { margin-bottom: 0.5rem; }
.category-header {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
    background-color: #f5f5f5;
}
.category-header:hover { background-color: #e8e8e8; }
.category-header span { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.category-header i.toggle-icon { transition: transform 0.4s ease-in-out; }
.category-header.collapsed i.toggle-icon { transform: rotate(-90deg); }
.category-count { font-size: 0.85rem; color: var(--lighter); font-weight: 400; }

.vocab-list {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 0;
}
.vocab-list.expanded { max-height: 10000px; opacity: 1; }

.vocab-item {
    padding: 0.75rem 1.5rem 0.75rem 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.vocab-item:hover { background-color: var(--bg-light); border-left-color: var(--accent); }
.vocab-item.active { background-color: var(--bg-light); border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.vocab-item span { flex: 1; line-height: 1.4; }

#alphabeticalList { list-style: none; padding: 0; display: none; }
#alphabeticalList .vocab-item { padding-left: 1.5rem; }

/* Vocab Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem;
}
.content-container { max-width: 1000px; margin: 0 auto; }

/* Vocab Header & Meta */
.vocab-header {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}
.vocab-header h1 { font-size: 2rem; margin-bottom: 0.5rem; color: var(--primary); }
.vocab-header .vocab-description { color: var(--light); font-size: 1rem; margin-bottom: 1rem; }
.vocab-meta { display: flex; gap: 2rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid #e5e7eb; }
.vocab-meta-item { display: flex; align-items: center; gap: 0.5rem; color: var(--light); font-size: 0.9rem; }
.vocab-meta-item i, .vocab-meta-item a { color: var(--accent); }

/* Tables */
.table-section {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.table-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.table-wrapper { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead { background-color: var(--bg-light); }
th { padding: 1rem; text-align: left; font-weight: 600; color: var(--primary); border-bottom: 2px solid #e5e7eb; }
td { padding: 0.9rem 1rem; border-bottom: 1px solid #e5e7eb; color: var(--secondary); }
tbody tr:hover { background-color: var(--bg-light); }

/* Code Blocks */
.code-section { margin-top: 2rem; }
.code-header {
    display: flex; justify-content: space-between; align-items: center;
    background-color: #2d2d2d; color: var(--white);
    padding: 0.75rem 1.25rem; border-radius: 4px 4px 0 0;
}
.code-block {
    background-color: #1e1e1e; color: #d4d4d4;
    padding: 1.5rem; border-radius: 0 0 4px 4px;
    overflow-x: auto; font-family: 'Courier New', monospace;
    font-size: 0.85rem; line-height: 1.5;
}

/* Welcome Message */
.welcome-message {
    background: var(--white); padding: 3rem;
    border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
}
.welcome-message i { font-size: 4rem; color: var(--accent); margin-bottom: 1rem; }
.welcome-message h2 { font-size: 2rem; margin-bottom: 1rem; }

/* Citation Box */
.citation {
    margin-top: 2rem; padding: 1.5rem;
    background-color: #f0f9ff;
    border-left: 4px solid var(--accent);
    border-radius: 4px;
}
.citation h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--primary); }

/* =========================================
   5. PORTFOLIO PAGE STYLES (Hero, Skills, Etc)
   ========================================= */

/* Hero */
.hero {
    min-height: 100vh;
    display: flex; align-items: center;
    padding: 0 2rem; margin-top: var(--nav-height);
}
.hero-content {
    max-width: var(--max-width); margin: 0 auto;
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 4rem; align-items: center;
}
.hero-text h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 700; line-height: 1.1; margin-bottom: 1rem; }
.hero-image img { width: 100%; max-width: 400px; border-radius: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.1); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 2rem; text-decoration: none;
    border-radius: 50px; transition: all 0.3s;
    font-weight: 500; border: none; cursor: pointer; font-size: 0.9rem;
}
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.btn-secondary { background: var(--secondary); color: var(--white); border-radius: 4px; padding: 0.6rem 1.2rem; }
.button-group { display: flex; gap: 1rem; }

/* Timeline */
.timeline { position: relative; padding: 2rem 0; }
.timeline::before {
    content: ''; position: absolute; left: 50%; transform: translateX(-50%);
    width: 2px; height: 100%; background: #eee;
}
.timeline-item { display: flex; justify-content: space-between; margin-bottom: 4rem; position: relative; }
.timeline-item:nth-child(even) { flex-direction: row-reverse; }
.timeline-content { width: 45%; background: var(--white); padding: 2rem; border-radius: 10px; position: relative; transition: all 0.3s; }
.timeline-date {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--white); padding: 0.5rem 1rem;
    border-radius: 20px; border: 2px solid var(--accent); font-weight: 600;
}

/* Skills Grid */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.skill-card { background: var(--white); padding: 2rem; border-radius: 10px; transition: all 0.3s; }
.skill-bar { width: 100%; height: 6px; background: #ddd; border-radius: 3px; overflow: hidden; }
.skill-progress { height: 100%; background: var(--accent); border-radius: 3px; }

/* Contact Form */
.contact-container { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; }
.contact-form { background: var(--white); padding: 2rem; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group textarea {
    width: 100%; padding: 0.75rem;
    border: 1px solid #ddd; border-radius: 5px;
}

/* Prank Button */
.prank-section { padding: 60px 0; background: linear-gradient(135deg, rgba(20, 20, 20, 0.9) 0%, rgba(40, 20, 20, 0.9) 100%); border-top: 2px solid rgba(255, 68, 68, 0.3); }
.prank-btn {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    color: #fff; font-size: 24px; font-weight: 700;
    padding: 20px 50px; border: 3px solid #ffffff; border-radius: 10px;
    cursor: pointer; text-transform: uppercase; animation: danger-pulse 2s infinite;
}

/* =========================================
   6. UTILITIES (Toast, Animations)
   ========================================= */
.toast {
    position: fixed; bottom: 2rem; right: 2rem;
    background-color: var(--success); color: var(--white);
    padding: 1rem 1.5rem; border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none; align-items: center; gap: 0.75rem; z-index: 2000;
    animation: slideIn 0.3s ease-out;
}
.toast.show { display: flex; }

/* Animations */
@keyframes slideIn { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes danger-pulse { 0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.5); } 50% { box-shadow: 0 0 40px rgba(255, 0, 0, 0.8); } }

/* =========================================
   7. RESPONSIVE DESIGN
   ========================================= */
.mobile-sidebar-toggle {
    display: none; position: fixed; bottom: 2rem; left: 2rem;
    width: 50px; height: 50px; background-color: var(--accent); color: var(--white);
    border: none; border-radius: 50%; font-size: 1.2rem; cursor: pointer;
    z-index: 1001; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    /* Navbar Mobile */
    .nav-links {
        display: none; position: absolute; top: var(--nav-height); left: 0; right: 0;
        background: var(--white); flex-direction: column; padding: 1rem;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }
    .nav-links.active { display: flex; }
    .menu-toggle { display: block; }

    /* Sidebar Mobile */
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; z-index: 999; }
    .sidebar.active { transform: translateX(0); }
    .mobile-sidebar-toggle { display: block; }
    .main-content { margin-left: 0; padding: 1.5rem; }

    /* Portfolio Mobile */
    .hero-content { grid-template-columns: 1fr; text-align: center; }
    .contact-container { grid-template-columns: 1fr; }
    .timeline-item { flex-direction: column !important; }
    .timeline-content { width: 100%; margin: 0; }
    .timeline-date { position: static; transform: none; display: inline-block; margin-bottom: 1rem; }
}

/* =========================================
   ZINGARATE (TRAVEL) SECTION
   ========================================= */

/* The Container for the whole trip */
.trip-accordion {
    background: var(--white);
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
    overflow: hidden; /* Keeps the animation clean */
    transition: all 0.3s ease;
}

/* The Clickable Header */
.trip-summary {
    padding: 1.5rem 2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    border-left: 5px solid transparent;
    transition: background 0.2s;
}

.trip-summary:hover {
    background: #fdfdfd;
}

/* Active State Styling */
.trip-accordion.active .trip-summary {
    border-left: 5px solid var(--accent);
    background: #f0f7ff; /* Very light blue tint when open */
}

.trip-title-group h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary);
}

.trip-date {
    font-size: 0.9rem;
    color: var(--light);
    font-family: monospace;
}

.toggle-icon {
    color: var(--light);
    transition: transform 0.3s ease;
}

.trip-accordion.active .toggle-icon {
    transform: rotate(180deg);
    color: var(--accent);
}

/* The Hidden Details Area */
.trip-details {
    display: none; /* Hidden by default */
    padding: 2rem;
    border-top: 1px solid #eee;
    background: var(--white);
    animation: fadeIn 0.5s ease;
}

.trip-accordion.active .trip-details {
    display: block; /* Shown when active */
}

/* Scaruffi-style Info Block */
.trip-header-meta {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--secondary);
    border: 1px solid #eee;
}

.trip-header-meta p {
    margin-bottom: 0.5rem;
}

/* Diary Grid Layout */
.diary-entry {
    display: grid;
    grid-template-columns: 1fr 300px; /* Text left, Images right */
    gap: 2rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.diary-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.diary-text h4 {
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.day-tag {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* Image Grid */
.diary-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: row;
    gap: 0.5rem;
    align-content: start;
}

.diary-gallery img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.3s;
    cursor: pointer;
    background: #ddd; /* Loading placeholder color */
}

.diary-gallery img:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.diary-gallery img.feature {
    grid-column: span 2;
    height: 160px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .diary-entry {
        grid-template-columns: 1fr; /* Stack vertically on phone */
    }
    .diary-gallery {
        grid-template-columns: repeat(3, 1fr); /* 3 across on phone */
        margin-top: 1rem;
    }
    .feature {
        grid-column: span 3;
    }
}

/* =========================================
   ZINGARATE (TRAVEL) PAGE STYLES
   ========================================= */

/* The Container for the whole trip */
.trip-accordion {
    background: var(--white);
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #eee;
}

/* The Clickable Header */
.trip-summary {
    padding: 1.5rem 2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    border-left: 5px solid transparent;
    transition: background 0.2s;
}

.trip-summary:hover {
    background: #fdfdfd;
}

/* Active State (When opened) */
.trip-accordion.active .trip-summary {
    border-left: 5px solid var(--accent);
    background: #f0f7ff; /* Light accent tint */
    border-bottom: 1px solid #eee;
}

.trip-title-group h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary);
}

.trip-date {
    font-size: 0.9rem;
    color: var(--light);
    font-family: monospace;
    margin-top: 0.25rem;
    display: block;
}

.toggle-icon {
    color: var(--light);
    transition: transform 0.3s ease;
}

.trip-accordion.active .toggle-icon {
    transform: rotate(180deg);
    color: var(--accent);
}

/* The Hidden Details Area */
.trip-details {
    display: none; /* Hidden by default */
    padding: 2rem;
    background: var(--white);
    animation: fadeIn 0.5s ease;
}

.trip-accordion.active .trip-details {
    display: block; /* Visible when active */
}

/* Scaruffi-style Meta Block */
.trip-header-meta {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--secondary);
    border: 1px solid #eee;
}

.trip-header-meta p {
    margin-bottom: 0.5rem;
}

/* Diary Entry Layout */
.diary-entry {
    display: grid;
    grid-template-columns: 1fr 300px; /* Text left, Images right */
    gap: 2rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.diary-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.diary-text h4 {
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.day-tag {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* Image Grid */
.diary-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    align-content: start;
}

.diary-gallery img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.3s;
    cursor: pointer;
    background: #ddd;
}

.diary-gallery img:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 2;
}

.diary-gallery img.feature {
    grid-column: span 2;
    height: 160px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .diary-entry {
        grid-template-columns: 1fr;
    }
    .diary-gallery {
        grid-template-columns: repeat(3, 1fr);
        margin-top: 1rem;
    }
    .feature {
        grid-column: span 3;
    }
}
