/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #00d4ff;
    --accent-color: #ff006e;
    --text-color: #ffffff;
    --text-secondary: #b0b0b0;
    --bg-color: #0a0a0a;
    --card-bg: #1a1a1a;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
}

/* Navigation */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    letter-spacing: 2px;
}

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

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--secondary-color);
    background: rgba(0, 212, 255, 0.1);
}

/* 3D Viewer Styles */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#three-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

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

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

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

#loading-text {
    color: var(--text-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

#progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    width: 0%;
    transition: width 0.3s ease;
}

/* Controls Info */
.controls-info {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    z-index: 100;
    max-width: 250px;
}

.controls-info h3 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.controls-info ul {
    list-style: none;
}

.controls-info li {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.controls-info strong {
    color: var(--text-color);
}

/* Gem Indicator */
.gem-indicator {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
    font-size: 1rem;
}

.gem-indicator span:first-child {
    color: var(--text-secondary);
}

#gem-state-indicator {
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 0 10px currentColor;
    transition: color 0.3s ease;
}

/* Gem Hint in Info Panel */
.gem-hint {
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 5px;
    font-size: 0.85rem;
}

.gem-hint strong {
    color: var(--secondary-color);
}

/* Info Panel */
.info-panel {
    position: fixed;
    top: 5rem;
    right: 2rem;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    z-index: 100;
    max-width: 350px;
    transition: var(--transition);
}

.info-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.info-panel.collapsed {
    padding: 1rem 1.5rem;
}

.info-panel.collapsed .info-panel-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-bottom: 0;
}

.info-panel.collapsed .info-panel-header {
    margin-bottom: 0;
}

.collapse-btn {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--secondary-color);
    font-size: 1.5rem;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.collapse-btn:hover {
    background: rgba(0, 212, 255, 0.3);
    border-color: var(--secondary-color);
}

.info-panel-content {
    max-height: 500px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.info-panel h2 {
    color: var(--secondary-color);
    margin-bottom: 0;
    font-size: 1.3rem;
}

.info-panel p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.info-panel .note {
    background: rgba(255, 0, 110, 0.1);
    border-left: 3px solid var(--accent-color);
    padding: 0.75rem;
    margin-top: 1rem;
    border-radius: 5px;
}

.info-panel code {
    background: rgba(0, 212, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    color: var(--secondary-color);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

/* Portfolio Page Styles */
.portfolio-page {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 5rem 0;
}

/* Portfolio Hero */
.portfolio-hero {
    padding: 8rem 0 5rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 0, 110, 0.1));
    margin-top: 60px;
}

.portfolio-hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
}

/* About Section */
.about-section {
    background: rgba(26, 26, 26, 0.5);
}

.about-section h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--secondary-color);
    text-align: center;
}

.about-section p {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* Projects Section */
.projects-section {
    background: var(--bg-color);
}

.projects-section h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--secondary-color);
    text-align: center;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.project-card:hover::before {
    transform: scaleX(1);
}

.project-card:hover {
    transform: translateY(-10px);
    border-color: var(--secondary-color);
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.2);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.project-card h3 {
    font-size: 1.5rem;
    color: var(--text-color);
}

.project-tag {
    background: rgba(0, 212, 255, 0.2);
    color: var(--secondary-color);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.project-card p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.project-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.project-link:hover {
    color: var(--accent-color);
    gap: 1rem;
}

/* Skills Section */
.skills-section {
    background: rgba(26, 26, 26, 0.5);
}

.skills-section h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--secondary-color);
    text-align: center;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.skill-category {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.skill-category h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.skill-category ul {
    list-style: none;
}

.skill-category li {
    color: var(--text-secondary);
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.skill-category li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--secondary-color);
}

/* Contact Section */
.contact-section {
    background: var(--bg-color);
    text-align: center;
}

.contact-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.contact-section p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: var(--text-color);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
}

.contact-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

/* Footer */
footer {
    background: var(--primary-color);
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
}

/* Project Page Styles */
.project-content-section {
    background: var(--bg-color);
    padding: 3rem 0;
}

.project-description {
    max-width: 900px;
    margin: 0 auto 4rem;
    text-align: left;
}

.project-description h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--secondary-color);
    text-align: center;
}

.project-description p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Photo Gallery */
.project-gallery {
    margin-bottom: 4rem;
}

.project-gallery h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--secondary-color);
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    transition: var(--transition);
    background: var(--card-bg);
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Loading placeholder background */
.gallery-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        rgba(26, 26, 26, 0.8) 0%, 
        rgba(0, 212, 255, 0.1) 50%, 
        rgba(26, 26, 26, 0.8) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    z-index: 1;
}

.gallery-item.image-loaded::before {
    opacity: 0;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.gallery-item:hover {
    transform: translateY(-10px);
    border-color: var(--secondary-color);
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    display: block;
    transition: var(--transition);
    object-fit: cover;
    /* Progressive loading styles */
    filter: blur(10px);
    opacity: 0.8;
    position: relative;
    z-index: 2;
}

.gallery-item img.loaded {
    filter: blur(0);
    opacity: 1;
    transition: filter 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Video Section */
.project-videos {
    margin-bottom: 4rem;
}

.project-videos h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--secondary-color);
    text-align: center;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.video-item {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    transition: var(--transition);
}

.video-item:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.2);
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    background: var(--bg-color);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-caption {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
}

/* Back to Portfolio */
.back-to-portfolio {
    text-align: center;
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .portfolio-hero h1 {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    section {
        padding: 3rem 0;
    }

    .projects-grid,
    .skills-grid {
        grid-template-columns: 1fr;
    }

    .controls-info,
    .info-panel {
        position: relative;
        margin: 1rem;
        max-width: 100%;
    }

    .info-panel {
        top: auto;
        right: auto;
        margin-top: 70px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .videos-grid {
        grid-template-columns: 1fr;
    }

    .project-description p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-brand {
        font-size: 1.2rem;
    }

    .portfolio-hero {
        padding: 6rem 0 3rem;
    }

    .portfolio-hero h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 2rem;
    }

    .project-description h2,
    .project-gallery h2,
    .project-videos h2 {
        font-size: 1.8rem;
    }
}
