* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ======== VARIABLES ======== */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #16213e;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-cyan: #00d4ff;
    --accent-purple: #a855f7;
    --accent-green: #10b981;
    --accent-blue: #0099ff;
    --border-color: rgba(0, 212, 255, 0.15);
    --border-hover: rgba(0, 212, 255, 0.3);
    --particle-color: 0, 212, 255;
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(0, 136, 204, 0.08);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-cyan: #0088cc;
    --accent-purple: #9333ea;
    --accent-green: #059669;
    --accent-blue: #0066aa;
    --border-color: rgba(0, 136, 204, 0.2);
    --border-hover: rgba(0, 136, 204, 0.4);
    --particle-color: 0, 136, 204;
}

/* ======== BASE ======== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

#particleCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
}

/* ======== HEADER ======== */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ======== CATEGORIES ======== */
.categories-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

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

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.category-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-8px);
}

.professional-category:hover { border-color: var(--accent-cyan); box-shadow: 0 20px 40px rgba(0, 212, 255, 0.15); }
.academic-category:hover { border-color: var(--accent-purple); box-shadow: 0 20px 40px rgba(168, 85, 247, 0.15); }
.personal-category:hover { border-color: var(--accent-green); box-shadow: 0 20px 40px rgba(16, 185, 129, 0.15); }

.category-icon {
    font-size: 3.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.category-card h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.professional-category h2 { color: var(--accent-cyan); }
.academic-category h2 { color: var(--accent-purple); }
.personal-category h2 { color: var(--accent-green); }

.category-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.project-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    background: var(--bg-card);
    border-radius: 20px;
}

.arrow-large {
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.category-card:hover .arrow-large {
    transform: translateX(5px);
}

/* ======== MODAL OVERLAY ======== */
.projects-list-view,
.project-detail,
.deliverables-modal,
.image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 39, 0.92);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    animation: fadeInModal 0.3s ease;
}

.projects-list-view.hidden,
.project-detail.hidden,
.deliverables-modal.hidden,
.image-lightbox.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ======== MODAL CONTENT ======== */
.modal-content,
.detail-card,
.deliverables-content {
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.95) 0%, rgba(10, 14, 39, 0.95) 100%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 1000px;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .modal-content,
[data-theme="light"] .detail-card,
[data-theme="light"] .deliverables-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

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

.modal-content { padding: 2.5rem; }
.detail-card { padding: 0; }
.deliverables-content { padding: 2.5rem; max-width: 1200px; }

/* ======== CLOSE BUTTON ======== */
.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.close-modal:hover {
    background: #ef4444;
    border-color: #ef4444;
    transform: scale(1.1);
}

[data-theme="light"] .close-modal {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: #1e293b;
}

[data-theme="light"] .close-modal:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

/* Scrollbar */
.modal-content::-webkit-scrollbar,
.detail-card::-webkit-scrollbar,
.deliverables-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track,
.detail-card::-webkit-scrollbar-track,
.deliverables-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb,
.detail-card::-webkit-scrollbar-thumb,
.deliverables-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ======== CATEGORY HEADER IN MODAL ======== */
.category-display-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-top: 1rem;
}

.category-icon-large {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.category-display-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.category-display-header p {
    color: var(--text-secondary);
}

/* ======== PROJECTS GRID ======== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.project-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    transform: translateY(-5px);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.project-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.project-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.tech-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tech-badge {
    padding: 0.3rem 0.7rem;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.arrow-icon {
    color: var(--accent-cyan);
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.project-card:hover .arrow-icon {
    transform: translateX(5px);
}

/* ======== PROJECT DETAIL ======== */
.project-detail {
    z-index: 1001;
}

.detail-header {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    padding: 2.5rem 2rem;
    padding-right: 4rem;
    border-radius: 20px 20px 0 0;
}

.detail-header h1 {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
}

.detail-content {
    padding: 2rem;
}

.tech-badges-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

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

.description p {
    margin-bottom: 0.8rem;
}

.detail-content h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.detail-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.8rem;
}

/* ======== FEATURES GRID ======== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature-section h3 {
    color: var(--accent-cyan);
    margin-bottom: 0.8rem;
}

.feature-section ul {
    list-style: none;
    padding: 0;
}

.feature-section li {
    color: var(--text-secondary);
    padding: 0.4rem 0;
    padding-left: 1.2rem;
    position: relative;
}

.feature-section li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-cyan);
}

/* ======== FEATURES CARDS ======== */
.features-section,
.tech-section,
.challenges-section,
.results-section {
    margin-top: 2rem;
}

.features-section h2,
.tech-section h2,
.challenges-section h2,
.results-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

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

.feature-card {
    background: rgba(22, 33, 62, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.1);
}

[data-theme="light"] .feature-card {
    background: rgba(241, 245, 249, 0.9);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.8rem;
}

.feature-card h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ======== TECH STACK GRID ======== */
.tech-stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.tech-category {
    background: rgba(22, 33, 62, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

[data-theme="light"] .tech-category {
    background: rgba(241, 245, 249, 0.9);
}

.tech-category h3 {
    color: var(--accent-cyan);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tech-category ul {
    list-style: none;
    padding: 0;
}

.tech-category li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.3rem 0;
    padding-left: 1rem;
    position: relative;
}

.tech-category li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent-cyan);
}

/* ======== CHALLENGES ======== */
.challenges-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.challenge-card {
    background: rgba(22, 33, 62, 0.6);
    border-left: 3px solid var(--accent-purple);
    border-radius: 8px;
    padding: 1.5rem;
}

[data-theme="light"] .challenge-card {
    background: rgba(241, 245, 249, 0.9);
}

.challenge-card h3 {
    color: var(--accent-purple);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.challenge-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ======== RESULTS ======== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card:hover {
    border-color: var(--accent-cyan);
    transform: scale(1.03);
}

.result-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.result-value {
    color: var(--accent-cyan);
    font-size: 1.2rem;
    font-weight: 700;
}

.result-metric {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ======== PROJECT LINKS ======== */
.project-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
}

.btn-deliverables {
    background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-deliverables:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3);
}

/* ======== DELIVERABLES MODAL ======== */
.deliverables-modal {
    z-index: 2000;
}

.deliverables-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-top: 1rem;
}

.deliverables-header h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.deliverables-header p {
    color: var(--text-secondary);
}

.deliverables-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.deliverable-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.deliverable-item:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-5px);
}

.deliverable-image-container {
    position: relative;
    width: 100%;
    padding-top: 60%;
    background: var(--bg-primary);
}

.deliverable-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.deliverable-item:hover .deliverable-image {
    transform: scale(1.05);
}

.deliverable-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.deliverable-item:hover .deliverable-overlay {
    opacity: 1;
}

.deliverable-overlay-icon {
    font-size: 2rem;
    color: #fff;
}

.deliverable-info {
    padding: 1rem;
}

.deliverable-category {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.deliverable-info h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.deliverable-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ======== LIGHTBOX ======== */
.image-lightbox {
    z-index: 3000;
    background: rgba(0, 0, 0, 0.95);
    align-items: center;
}

.lightbox-content {
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
}

.lightbox-info {
    text-align: center;
    margin-top: 1rem;
}

.lightbox-info h3 {
    color: #fff;
    font-size: 1.2rem;
}

.lightbox-info p {
    color: var(--text-muted);
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: #ef4444;
    border-color: #ef4444;
}

/* ======== HOME BUTTON ======== */
.home-button {
    display: block;
    width: fit-content;
    margin: 3rem auto 0;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.home-button:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.back-button {
    display: inline-block;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.back-button.hidden {
    display: none;
}

/* ======== THEME TOGGLE ======== */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    color: var(--text-primary);
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
[data-theme="light"] .theme-toggle .sun-icon { display: block; }
[data-theme="light"] .theme-toggle .moon-icon { display: none; }

/* ======== RESPONSIVE ======== */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .categories-view {
        grid-template-columns: 1fr;
    }

    .category-card {
        padding: 2rem 1.5rem;
    }

    .projects-list-view,
    .project-detail,
    .deliverables-modal {
        padding: 1rem;
    }

    .modal-content,
    .deliverables-content {
        padding: 1.5rem;
    }

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

    .detail-header {
        padding: 2rem 1.5rem;
        padding-right: 3.5rem;
    }

    .detail-header h1 {
        font-size: 1.5rem;
    }

    .detail-content {
        padding: 1.5rem;
    }

    .features-grid,
    .features-cards,
    .tech-stack-grid,
    .results-grid {
        grid-template-columns: 1fr;
    }

    .project-links {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary,
    .btn-deliverables {
        width: 100%;
        text-align: center;
    }

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

    .close-modal {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.6rem;
    }

    .header p {
        font-size: 0.95rem;
    }

    .category-card {
        padding: 1.5rem 1rem;
    }

    .category-icon {
        font-size: 2.5rem;
    }

    .category-card h2 {
        font-size: 1.2rem;
    }

    .detail-header {
        padding: 1.5rem 1rem;
        padding-right: 3rem;
    }

    .detail-header h1 {
        font-size: 1.3rem;
    }

    .detail-content {
        padding: 1rem;
    }

    .close-modal {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        top: 0.8rem;
        right: 0.8rem;
    }

    .theme-toggle {
        width: 42px;
        height: 42px;
        top: 1rem;
        right: 1rem;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }
}
