/* ==========================================
   CSS Design System for HKNU 2026 Studio Portfolio
   ========================================== */

:root {
    --bg-main: #070913;
    --bg-surface: rgba(15, 18, 36, 0.6);
    --bg-surface-hover: rgba(25, 30, 60, 0.8);
    --border-glow: rgba(99, 102, 241, 0.03);
    --border-light: rgba(255, 255, 255, 0.08);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --secondary: #a855f7;
    --accent: #10b981;
    --warning: #f59e0b;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --font-sans: 'Outfit', 'Noto Sans KR', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --gradient-purple-blue: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    --gradient-glow: radial-gradient(circle, rgba(99,102,241,0.15) 0%, rgba(7,9,19,0) 70%);
}

/* Light Theme Overrides */
body.theme-light {
    --bg-main: #f1f5f9;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 255, 255, 0.95);
    --border-glow: rgba(99, 102, 241, 0.05);
    --border-light: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
}

body.theme-light .app-header-grid h1 {
    background: linear-gradient(135deg, #0f172a 30%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.theme-light .view-header h2 {
    color: #0f172a;
    background: none;
    -webkit-text-fill-color: initial;
}

body.theme-light .glow-blob {
    display: block;
    opacity: 0.15;
    filter: blur(120px);
}

body.theme-light .badge {
    background: rgba(99, 102, 241, 0.05);
}

body.theme-light .tab-btn:not(.active) {
    color: var(--text-secondary);
}

body.theme-light .category-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.theme-light .category-count {
    background: rgba(0, 0, 0, 0.04);
}

body.theme-light .portfolio-card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

body.theme-light .portfolio-card:hover {
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.1), 0 10px 10px -5px rgba(99, 102, 241, 0.04);
}

body.theme-light .thumbnail-placeholder {
    background: #e2e8f0;
    color: #475569;
}

body.theme-light .thumbnail-placeholder i {
    color: #4f46e5;
}

body.theme-light .thumbnail-placeholder span {
    color: #0f172a;
    font-weight: 600;
}

body.theme-light .project-tag {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
}

body.theme-light .student-tag {
    color: #7e22ce;
    background: rgba(126, 34, 206, 0.08);
}

body.theme-light .category-item.active {
    background: rgba(99, 102, 241, 0.08);
}

body.theme-light .card-action-btn {
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
}

body.theme-light .card-action-btn:hover {
    color: #fff;
}

/* Gray Theme Overrides */
body.theme-gray {
    --bg-main: #18181b;
    --bg-surface: rgba(39, 39, 42, 0.6);
    --bg-surface-hover: rgba(63, 63, 70, 0.85);
    --border-glow: rgba(255, 255, 255, 0.03);
    --border-light: rgba(255, 255, 255, 0.06);
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --primary: #a1a1aa;
    --secondary: #d4d4d8;
    --gradient-purple-blue: linear-gradient(135deg, #52525b 0%, #27272a 100%);
    --primary-glow: rgba(161, 161, 170, 0.2);
}

body.theme-gray .app-header-grid h1 {
    background: linear-gradient(135deg, #ffffff 40%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.theme-gray .glow-blob {
    opacity: 0.08;
}

body.theme-gray .badge {
    color: #a1a1aa;
}

body.theme-gray .view-header h2 {
    color: #ffffff;
    background: none;
    -webkit-text-fill-color: initial;
}

body.theme-gray .thumbnail-placeholder {
    background: #27272a;
    color: #a1a1aa;
}

body.theme-gray .thumbnail-placeholder i {
    color: #a1a1aa;
}

body.theme-gray .thumbnail-placeholder span {
    color: #f4f4f5;
    font-weight: 600;
}

body.theme-gray .project-tag {
    color: #d4d4d8;
    background: rgba(255, 255, 255, 0.06);
}

body.theme-gray .student-tag {
    color: #e4e4e7;
    background: rgba(255, 255, 255, 0.08);
}

body.theme-gray .category-item.active {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Background Glow Blobs */
.glow-blob {
    display: none;
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.02) 50%, rgba(7, 9, 19, 0) 100%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -200px;
    left: -100px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, rgba(7, 9, 19, 0) 70%);
}

.blob-2 {
    bottom: -200px;
    right: -100px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(7, 9, 19, 0) 70%);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.03) 0%, rgba(7, 9, 19, 0) 70%);
    animation: pulse 15s infinite alternate ease-in-out;
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(50px) rotate(20deg); }
}

@keyframes pulse {
    0% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.9); }
    100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

/* App Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Grid Layout (2 Columns) */
.app-header-grid {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
    padding: 2.5rem 0;
    margin-bottom: 2.5rem;
    position: relative;
    border-bottom: 1px solid var(--border-light);
}

.header-left {
    flex: 1;
    text-align: left;
}

.app-header-grid h1 {
    font-size: 2.8rem;
    letter-spacing: -0.02em;
    color: #ffffff;
    line-height: 1.25;
}

.app-header-grid h1 .title-light {
    font-weight: 200;
    font-size: 0.8em;
}

.app-header-grid h1 .title-bold {
    font-weight: 700;
    font-size: 1.25em;
}

.header-divider {
    width: 1px;
    height: 40px;
    background-color: var(--border-light);
    align-self: center;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.header-right .tabs-container {
    width: 100%;
    display: flex;
}

.header-right .tab-btn {
    flex: 1;
    justify-content: center;
}

.header-right .search-filter-wrapper {
    width: 100%;
    max-width: 100%;
    display: none;
}

/* Stats Bar */
.stats-bar {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 100px;
    backdrop-filter: blur(20px);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.stat-item i {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.stat-item strong {
    color: var(--text-primary);
    margin-left: 0.25rem;
}

.stat-divider {
    width: 1px;
    height: 16px;
    background-color: var(--border-light);
}


/* Tabs */
.tabs-container {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    padding: 0.35rem;
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.6rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 12px;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--gradient-purple-blue);
    color: #fff;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.tab-btn i {
    width: 18px;
    height: 18px;
}

/* Search Box */
.search-filter-wrapper {
    width: 100%;
    max-width: 400px;
    display: none;
}

.search-box {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 1.2rem 0.8rem 2.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: var(--bg-surface-hover);
}

.search-icon {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

.clear-btn {
    position: absolute;
    right: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.clear-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.clear-btn i {
    width: 16px;
    height: 16px;
}

/* Main Layout: Sidebar & Content */
.view-section {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.view-section.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.5s forwards ease;
}

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

.sidebar-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    align-items: start;
}

/* Sidebar Styling */
.category-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    position: sticky;
    top: 2rem;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-light);
    letter-spacing: -0.01em;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}

/* Custom Scrollbar for sidebar */
.category-list::-webkit-scrollbar {
    width: 4px;
}
.category-list::-webkit-scrollbar-track {
    background: transparent;
}
.category-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 99px;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.category-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary);
    font-weight: 500;
}

.category-count {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 99px;
    color: var(--text-muted);
}

.category-item.active .category-count {
    background: var(--primary);
    color: #fff;
}

/* Results Area */
.results-area {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.view-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.view-header h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 60%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.view-description {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
}

/* Profile header for Student View */
.student-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.domain-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.domain-link:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.domain-link i {
    width: 16px;
    height: 16px;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Student Project Cards (For Student View) */
.student-projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Project Card Base */
.portfolio-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.portfolio-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
}

/* Card Visual/Thumbnail Block */
.card-thumbnail {
    height: 160px;
    width: 100%;
    position: relative;
    background: linear-gradient(135deg, rgba(20, 25, 55, 0.8) 0%, rgba(10, 12, 30, 0.9) 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-light);
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.portfolio-card:hover .card-thumbnail img {
    transform: scale(1.05);
}

.card-thumbnail iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Placeholder for thumbnail when image fails or doesn't exist */
.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15) 0%, rgba(7, 9, 19, 0.4) 100%);
    padding: 1.5rem;
    text-align: center;
}

.thumbnail-placeholder i {
    width: 32px;
    height: 32px;
    color: var(--primary);
    opacity: 0.8;
}

.thumbnail-placeholder span {
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Card Info */
.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 1rem;
}

.card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.card-title-row h4 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.student-tag {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--secondary);
    background: rgba(168, 85, 247, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
}

.project-tag {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
}

.card-url-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

/* Card Button */
.card-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.portfolio-card:hover .card-action-btn {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.card-action-btn i {
    width: 16px;
    height: 16px;
}

/* Empty View Card */
.no-results-card {
    grid-column: 1 / -1;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 4rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 500px;
    margin: 3rem auto;
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.no-results-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
}

.no-results-card p {
    color: var(--text-secondary);
}

.reset-search-btn {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.reset-search-btn:hover {
    background: #4f46e5;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* App Footer */
.app-footer {
    margin-top: auto;
    padding: 4rem 0 2rem;
    text-align: center;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ==========================================
   Responsive Design (Media Queries)
   ========================================== */

@media (max-width: 1024px) {
    .sidebar-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .category-sidebar {
        position: static;
    }
    
    .category-list {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        max-height: none;
        padding-bottom: 0.5rem;
    }
    
    .category-item {
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .app-header-grid {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        padding: 1.5rem 0;
    }
    
    .header-left {
        text-align: center;
    }
    
    .app-header-grid h1 {
        font-size: 2.2rem;
    }
    
    .header-divider {
        display: none;
    }
    
    .header-right {
        max-width: none;
        align-items: stretch;
    }
    
    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }

    .top-bar-container {
        justify-content: center;
        margin-bottom: 0.5rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* Top Utility Bar (Stats & Theme Switcher) */
.top-bar-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    margin-bottom: -1.5rem;
    z-index: 100;
}

.top-bar-container .stats-bar {
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    border-radius: 99px;
    backdrop-filter: blur(10px);
}

.top-bar-container .stat-item i {
    width: 16px;
    height: 16px;
}

.top-bar-container .stat-divider {
    height: 12px;
}

.theme-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 99px;
    padding: 0.25rem;
    backdrop-filter: blur(10px);
}

body.theme-light .theme-switcher {
    background: rgba(15, 23, 42, 0.04);
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.theme-btn i {
    width: 18px;
    height: 18px;
}

.theme-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

body.theme-light .theme-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Active Theme States */
body.theme-light #theme-btn-light,
body:not(.theme-light):not(.theme-gray) #theme-btn-dark,
body.theme-gray #theme-btn-gray {
    background: var(--gradient-purple-blue);
    color: #fff !important;
    box-shadow: 0 4px 12px var(--primary-glow);
}
