/* ============================================
   StudyHub - Layout (Universal Tools Style)
   ============================================ */

/* === App Container === */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Navbar === */
.navbar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    width: 100%;
    height: 64px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s;
}

[data-theme="dark"] .navbar {
    background: rgba(15, 17, 23, 0.8);
}

.navbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--color-brand);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: var(--text-sm);
    box-shadow: var(--shadow-sm);
}

.logo-text {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-text span {
    color: var(--color-brand);
    font-weight: 400;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

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

/* === Main Content === */
.main {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1rem 5rem;
    width: 100%;
}

/* === Hero Section === */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero-title .text-brand {
    color: var(--color-brand);
}

.hero-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto;
}

/* === Search Bar === */
.search-container {
    max-width: 576px;
    margin: 2rem auto 1.5rem;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-icon svg {
    width: 20px;
    height: 20px;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* === Category Chips === */
.category-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.chip {
    padding: 0.375rem 1rem;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.chip:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-color-hover);
}

.chip.active {
    background: var(--color-brand);
    border-color: var(--color-brand);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* === Bento Grid === */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
}

/* === Cards === */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-hover);
}

/* Featured Card (2x2) */
.card-featured {
    grid-column: span 2;
    grid-row: span 2;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .card-featured {
        grid-column: span 1;
        grid-row: span 1;
    }
}

.card-featured-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 128px;
    height: 128px;
    opacity: 0.1;
    color: var(--color-brand);
    transition: opacity var(--transition-base);
}

.card-featured:hover .card-featured-bg {
    opacity: 0.2;
}

/* Drag Active State for Featured Card */
.card-featured.drag-active {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), var(--shadow-lg);
    transform: scale(1.02);
}

.card-featured.drag-active .card-cta {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }
}

/* Wide Card (2 columns) */
.card-wide {
    grid-column: span 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .card-wide {
        grid-column: span 1;
    }
}

/* Card Icon */
.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: transform var(--transition-fast);
}

.card:hover .card-icon {
    transform: scale(1.1);
}

.card-icon svg {
    width: 24px;
    height: 24px;
}

/* Icon Colors by Category */
.card-icon.pdf {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.card-icon.text {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.card-icon.math {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.card-icon.productivity {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.card-icon.convert {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

[data-theme="dark"] .card-icon.pdf {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .card-icon.text {
    background: rgba(139, 92, 246, 0.15);
}

[data-theme="dark"] .card-icon.math {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .card-icon.productivity {
    background: rgba(249, 115, 22, 0.15);
}

[data-theme="dark"] .card-icon.convert {
    background: rgba(16, 185, 129, 0.15);
}

/* Card Content */
.card-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.card-featured .card-title {
    font-size: var(--text-2xl);
    margin-bottom: 0.5rem;
}

.card-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Hot Badge */
.badge-hot {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
    margin-bottom: 1rem;
}

[data-theme="dark"] .badge-hot {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Card CTA Button */
.card-cta {
    width: 100%;
    padding: 0.875rem;
    background: var(--color-brand);
    color: white;
    border-radius: var(--radius-xl);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    transition: background var(--transition-fast);
}

.card-cta:hover {
    background: var(--color-brand-hover);
}

.card-cta svg {
    width: 20px;
    height: 20px;
}

.card-cta-hint {
    text-align: center;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Card Arrow */
.card-arrow {
    width: 32px;
    height: 32px;
    background: var(--bg-muted);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.card-arrow svg {
    width: 16px;
    height: 16px;
}

/* === Ad Card === */
.card-ad {
    background: var(--bg-muted);
    border-style: dashed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0.7;
    min-height: 120px;
}

.card-ad-label {
    font-size: 0.625rem;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card-ad-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* === Footer === */
.footer {
    padding: 2rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: var(--text-sm);
}