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

:root {
    --primary-color: #4a90e2;
    --secondary-color: #50c878;
    --tertiary-color: #9b59b6;
    --text-color: #333;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --border-color: #e1e8ed;
    --error-color: #e74c3c;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

main {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.controls {
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #45b369;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(80, 200, 120, 0.3);
}

.btn-tertiary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-tertiary:hover {
    background: var(--border-color);
}

.filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-color);
}

.filter-group select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-group small {
    color: #666;
    font-size: 0.85rem;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.joke-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 30px;
    color: white;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.5s ease-out;
}

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

.joke-content {
    margin-bottom: 20px;
}

.setup {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
    line-height: 1.6;
}

.punchline {
    font-size: 1.2rem;
    font-style: italic;
    opacity: 0.95;
    line-height: 1.6;
}

.joke-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.category {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.error {
    background: #fee;
    border: 2px solid var(--error-color);
    color: var(--error-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
}

.hidden {
    display: none;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: white;
    opacity: 0.8;
}

footer a {
    color: white;
    text-decoration: underline;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2.5rem;
    }

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

    .action-buttons {
        flex-direction: column;
    }

    .joke-meta {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}
