/* Tutorial Page Layout */
.tutorial-page {
    padding-top: 2rem;
    padding-bottom: 4rem;
    background-color: var(--bg-light); /* Slight purple background for distinction */
    min-height: calc(100vh - 65px);
}

.tutorial-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .tutorial-wrapper {
        flex-direction: row;
        align-items: flex-start;
        gap: 3rem; /* Space between sidebar and content */
    }
}

/* Sidebar Toggle Button (Mobile/Tablet) */
.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.2);
    margin: 0 auto 2rem;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

@media (min-width: 1024px) {
    .sidebar-toggle-btn {
        display: none; /* Hide on large screens where sidebar is always visible */
    }
}

/* Sidebar Styles */
.tutorial-sidebar {
    display: none; /* Hidden by default on mobile */
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    width: 100%;
    
    /* Animation initial state */
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-sidebar.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.tutorial-sidebar.mobile-open {
    display: block;
    margin-bottom: 2rem;
}

@media (min-width: 1024px) {
    .tutorial-sidebar {
        display: block;
        position: sticky;
        top: 90px; /* Stick below header */
        width: 260px; /* Fixed width for sidebar */
        flex-shrink: 0; /* Prevent sidebar from shrinking */
        height: calc(100vh - 120px);
        overflow-y: auto;
        margin-bottom: 0;
    }
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title:first-child {
    margin-top: 0;
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    color: var(--primary-color);
    background-color: var(--bg-light);
}

.sidebar-link.active {
    color: var(--primary-color);
    font-weight: 600;
    background-color: #f3e8ff; /* slightly darker purple for active item */
    border-left: 3px solid var(--primary-color);
}

/* Content Area Styles */
.tutorial-content-area {
    flex: 1; /* Take up remaining space */
    min-width: 0; /* Prevent flex blowout */
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.tutorial-section h2 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    
    /* Animation initial state */
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-section h2.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.tutorial-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
    
    /* Animation initial state */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.tutorial-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.tutorial-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Image Handling */
.image-card {
    width: 100%;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    
    /* Animation initial state */
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-card.animate-in {
    opacity: 1;
    transform: scale(1);
}

.image-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.image-card:hover img {
    transform: scale(1.03);
}

.image-pair-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 1.5rem 0;
    
    /* Animation initial state */
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-pair-card.animate-in {
    opacity: 1;
    transform: scale(1);
}

@media (min-width: 768px) {
    .image-pair-card {
        flex-direction: row;
    }
    
    .image-pair-card img {
        width: calc(50% - 0.75rem);
        border-radius: 0.5rem;
        border: 1px solid var(--border-color);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        object-fit: cover;
    }
}

.tutorial-card h4 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.tutorial-card p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.tutorial-card ul {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.tutorial-card li {
    margin-bottom: 0.5rem;
}

.tutorial-card code {
    background-color: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9em;
    color: #e11d48;
}

.tip-box {
    background-color: #eff6ff; /* light blue */
    border-left: 4px solid var(--accent-blue);
    padding: 1rem;
    margin-top: 1.5rem;
    border-radius: 0 0.25rem 0.25rem 0;
    color: #1e3a8a;
}

.more-content-placeholder {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    font-style: italic;
}