:root {
    /* OpenPrompts - Light Elegant Theme */
    --primary: #6366f1;
    /* Indigo */
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    /* Indigo 50 */

    --background: #fafafa;
    /* Light gray */
    --surface: #ffffff;
    /* Pure white cards */
    --surface-hover: #f4f4f5;

    --border: #e4e4e7;
    /* Zinc 200 */
    --border-focus: #a5b4fc;
    /* Indigo 300 */

    --text-primary: #18181b;
    /* Zinc 900 */
    --text-secondary: #71717a;
    /* Zinc 500 */
    --text-muted: #a1a1aa;
    /* Zinc 400 */

    /* Category Colors */
    --coding: #3b82f6;
    --writing: #8b5cf6;
    --art: #ec4899;
    --business: #f59e0b;
    --education: #10b981;
    --general: #71717a;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* ========== DARK MODE ========== */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: rgba(99, 102, 241, 0.15);

    --background: #0f0f11;
    --surface: #18181b;
    --surface-hover: #27272a;

    --border: #2e2e33;
    --border-focus: #6366f1;

    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .danger-zone {
    border-color: #991b1b;
    background: #1c1111;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

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

body {
    background-color: var(--background);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* ========== NAVBAR ========== */
header.container {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

header nav ul {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1rem;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.theme-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: rotate(20deg);
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* Removed complex cropping styles as per user request */
.logo-img {
    height: 48px;
    /* Adjust height to fit navbar */
    width: auto;
    display: block;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
}

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

/* ========== MAIN CONTAINER ========== */
main.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ========== FEED HEADER ========== */
.feed-header {
    text-align: center;
    padding: 3rem 0 2rem;
}

.feed-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.feed-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.feed-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.add-prompt-btn {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.add-prompt-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

/* ========== CATEGORY FILTERS ========== */
.category-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.5rem;
}

.filter-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== PROMPT FEED ========== */
.prompt-feed {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ========== PROMPT CARD ========== */
.prompt-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.prompt-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.prompt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.category-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.category-badge.coding {
    background: rgba(59, 130, 246, 0.1);
    color: var(--coding);
}

.category-badge.writing {
    background: rgba(139, 92, 246, 0.1);
    color: var(--writing);
}

.category-badge.art {
    background: rgba(236, 72, 153, 0.1);
    color: var(--art);
}

.category-badge.business {
    background: rgba(245, 158, 11, 0.1);
    color: var(--business);
}

.category-badge.education {
    background: rgba(16, 185, 129, 0.1);
    color: var(--education);
}

.category-badge.general {
    background: rgba(113, 113, 122, 0.1);
    color: var(--general);
}

.upvote-count {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.prompt-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.4;
}

.prompt-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.prompt-preview {
    background: var(--background);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.prompt-preview code {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.prompt-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.author {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.author strong {
    color: var(--text-secondary);
    font-weight: 500;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.copy-btn,
.view-btn {
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.copy-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.copy-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

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

.view-btn:hover {
    background: var(--primary-hover);
}

/* ========== AUTH CARD ========== */
.auth-card {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* ========== FORMS ========== */
form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

form input,
form select,
form textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

form input::placeholder,
form textarea::placeholder {
    color: var(--text-muted);
}

form button[type="submit"] {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

form button[type="submit"]:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

form p {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

/* ========== CREATE PROMPT ========== */
.create-prompt {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 0;
}

.create-prompt h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.create-prompt .subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.prompt-form textarea {
    font-family: 'JetBrains Mono', monospace;
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.cancel-btn {
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.submit-btn {
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.empty-state h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

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

/* ========== INFINITE SCROLL ========== */
.scroll-loader {
    display: flex;
    justify-content: center;
    padding: 2rem;
    width: 100%;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========== NAV AVATAR ========== */
.nav-user-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 100px;
    transition: all 0.2s;
}

.nav-user-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* ========== PROFILE PAGE ========== */
.profile-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-info h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.profile-email {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.profile-joined {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.profile-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.profile-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.prompt-count {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 1rem;
}

.edit-profile-form {
    max-width: 400px;
}

.success-msg {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.error-msg {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.danger-zone {
    border-color: #fecaca;
    background: #fff5f5;
}

.danger-zone h2 {
    color: #dc2626;
}

.danger-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.btn-danger {
    background: #dc2626;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.delete-prompt-btn {
    background: none;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-prompt-btn:hover {
    background: #fef2f2;
}

/* ========== PROMPT MODAL ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--border);
}

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

.modal-author {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

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

.modal-content-box {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    max-height: 40vh;
    overflow-y: auto;
}

.modal-content-box code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    main.container {
        padding: 1rem;
    }

    .feed-title-row {
        flex-direction: column;
        text-align: center;
    }

    .prompt-feed {
        grid-template-columns: 1fr;
    }

    .auth-card {
        margin: 1rem;
        padding: 1.5rem;
    }

    .modal-card {
        padding: 1.5rem;
        padding-top: 3.5rem;
        max-height: 90vh;
    }

    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
    }
}