/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Background styling - placeholder for future image */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("./assets/images/background.png");
    background-size: cover;
    z-index: -2;
}

.background-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
}

/* Header styles */
.main-header {
    text-align: center;
    padding: 0.75rem 0;
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.main-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #ffffff;
    line-height: 1.2;
}

.main-header h2 {
    display: none; /* Hidden since we combined into one line */
}

/* Main container */
.projects-container {
    height: calc(100vh - 80px); /* Reduced from 160px to account for smaller header */
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Projects grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
    height: 100%;
    max-width: 1600px;
    max-height: 900px;
}

/* Individual project cards */
.project-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    width: 100%;
    height: 100%;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

.project-card:hover::before {
    left: 100%;
}

.project-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Project title at the top */
.project-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: #ffffff;
    line-height: 1.2;
    text-align: center;
    width: 100%;
    flex-shrink: 0;
    
    /* Reserve space for exactly 2 lines */
    min-height: 2.4em; /* 1.2em line-height * 2 lines */
    
    /* Center container for title text */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Inner title text with line clamping */
.project-title-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Main content area with image and sidebar */
.project-content {
    display: flex;
    gap: 1rem;
    flex: 1;
    height: 100%;
}

/* Left side - Main image (60%) */
.project-image {
    flex: 0 0 60%;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 192px;
    max-height: 192px;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.project-image img:hover {
    transform: scale(1.05);
}

.project-image .placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    text-align: center;
    padding: 1rem;
    font-style: italic;
}

/* Right side - QR code, author, tags (40%) */
.project-sidebar {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* QR Code styling */
.qr-code {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    background: white;
    padding: 3px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    margin-bottom: 0.2rem;
}

.qr-code img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* Author styling */
.project-author {
    font-size: 0.85rem;
    color: #e0e0e0;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

/* Tags styling */
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: center;
    max-height: 60px;
    overflow: hidden;
}

.project-tag {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

/* Remove old project-meta styling */
.project-meta {
    display: none;
}

.project-date {
    display: none;
}

/* Loading indicator */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    padding: 2rem 3rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.loading-indicator.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    font-size: 1.1rem;
    color: #ffffff;
}

/* Yellow progress bar at bottom of screen */
.bottom-progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1000;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500); /* Gold to orange gradient */
    width: 0%;
    transition: none;
}

.progress-fill.animating {
    transition: width 15s linear; /* Fallback for browsers without CSS custom property support */
    transition: width var(--progress-duration, 15s) linear;
}

/* Alternative animation using keyframes for better compatibility */
@keyframes progress-width {
    from { width: 0%; }
    to { width: 100%; }
}

.progress-fill.animating-keyframes {
    animation: progress-width 15s linear forwards;
    animation-duration: var(--progress-duration, 15s);
}

@keyframes progress-fill {
    from { width: 0%; }
    to { width: 100%; }
}

/* Project counter in top right corner */
.project-counter-overlay {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 16px;
}

.project-counter {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
    text-align: center;
}

/* Responsive design for different screen sizes */
@media (max-width: 1600px) {
    .projects-grid {
        gap: 1.2rem;
        max-width: 1400px;
        max-height: 800px;
    }
    
    .main-header h1 {
        font-size: 1.6rem;
    }
    
    .project-card {
        padding: 1rem;
    }
    
    .qr-code {
        width: 70px;
        height: 70px;
    }
    
    .project-title {
        font-size: 0.9rem;
    }
    
    .project-author {
        font-size: 0.8rem;
    }
    
    .project-tag {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
    }
}

@media (max-width: 1200px) {
    .projects-grid {
        gap: 1rem;
        max-width: 1200px;
        max-height: 700px;
    }
    
    .project-card {
        padding: 0.8rem;
        border-radius: 12px;
    }
    
    .qr-code {
        width: 60px;
        height: 60px;
    }
    
    .project-title {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
    }
    
    .project-content {
        gap: 0.8rem;
    }
    
    .project-image {
        border-radius: 8px;
    }
    
    .project-author {
        font-size: 0.75rem;
    }
    
    .project-tag {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
    }
    
    .project-sidebar {
        gap: 0.6rem;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.fade-out {
    animation: fadeOut 0.3s ease-in-out forwards;
}

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

/* Error state */
.error-message {
    text-align: center;
    color: #ff6b6b;
    font-size: 1.2rem;
    padding: 2rem;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    margin: 2rem;
}
