* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: var(--darkgray);
    color: var(--text-primary);
    line-height: 1.6;
}

#content {
    min-height: calc(100svh - var(--pageheader-height));
    padding: 4rem 0;
}

/* Header Section */
.resources-header {
    text-align: center;
    padding: 2rem 2rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.resources-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.resources-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

/* Admin Controls */
.admin-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--hoverColor));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 132, 255, 0.3);
}

/* Cards Container */
#cards {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    align-items: start;
}

/* Topic Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    height: 250px;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(15, 132, 255, 0.2), 0 0 0 1px rgba(15, 132, 255, 0.1);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--tertiary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

.card:hover .remove-topic-btn {
    opacity: 1;
    transform: scale(1);
}

/* Card Content */
.card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2rem;
    position: relative;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    font-weight: 700;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.card h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
    text-align: left;
}

.card-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Add Topic Card */
.card.add {
    border: 2px dashed var(--border-color);
    background-color: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
}

.card.add:hover {
    border-color: var(--primary);
    background-color: rgba(15, 132, 255, 0.05);
    transform: translateY(-4px);
}

.card.add a {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card.add .card-icon {
    background: linear-gradient(135deg, var(--text-secondary), var(--border-color));
    margin-bottom: 1rem;
}

.card.add h1 {
    font-size: 3rem;
    color: var(--text-secondary);
    justify-content: center;
    transition: all 0.2s ease;
}

.card.add:hover h1 {
    color: var(--primary);
    transform: scale(1.1);
}

/* Remove Button */
.remove-topic-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    fill: var(--error);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.remove-topic-btn:hover {
    background-color: var(--error);
    border-color: var(--error);
    fill: white;
    transform: scale(1.1);
}

.remove-topic-btn svg {
    width: 16px;
    height: 16px;
}

/* New Topic Form */
.card.new-topic {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 132, 255, 0.1);
}

.card.new-topic auto-resize-input {
    width: 100%;
    max-width: 100%;
}

.new-name-input {
    display: flex;
    width: 100%;
    
    .text-input {
        width: 100%;
        background-color: var(--input-bg);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 1rem;
        font-size: 1.2rem;
        font-weight: 600;
        color: var(--text-primary);
        outline: none;
        transition: all 0.2s ease;
        text-align: center;
    }

    .text-input::placeholder {
        color: var(--text-secondary);
    }

    .text-input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(15, 132, 255, 0.1);
    }

    .text-input.error {
        border-color: var(--error);
        box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
    }
}

/* Stats Section */
.stats-section {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 3rem 2rem;
    margin: 4rem 0;
}

.stats-container {
    max-width: 1200px;
    margin: 0 auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(15, 132, 255, 0.15);
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: block;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Animation Classes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.fade-in-up:nth-child(1) { animation-delay: 0.1s; }
.fade-in-up:nth-child(2) { animation-delay: 0.2s; }
.fade-in-up:nth-child(3) { animation-delay: 0.3s; }
.fade-in-up:nth-child(4) { animation-delay: 0.4s; }
.fade-in-up:nth-child(5) { animation-delay: 0.5s; }

/* Responsive Design */
@media (max-width: 1200px) {
    #cards {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    #content {
        padding: 2rem 0;
    }

    .resources-header {
        padding: 1rem 1rem 3rem;
    }
    
    .resources-title {
        font-size: 2rem;
    }
    
    .resources-subtitle {
        font-size: 1rem;
    }
    
    #cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .card {
        height: 200px;
    }
    
    .card a {
        padding: 1.5rem;
    }
    
    .card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .card h1 {
        font-size: 1.2rem;
    }
    
    .card.add h1 {
        font-size: 2.5rem;
    }
    
    .stats-section {
        padding: 2rem 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}