:root {
    --bg-dark: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-hover: #242424;
    --bg-input: #1f1f1f;
    --header-bg: #000;
    --accent-primary: #3b82f6;
    --accent-success: #22c55e;
    --accent-danger: #ef4444;
    --accent-warning: #f59e0b;
    --accent-orange: #f97316;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: #2a2a2a;
    --upvote: #f97316;
    --downvote: #6366f1;
}

[data-theme="light"] {
    --bg-dark: #f5f5f5;
    --bg-card: #ffffff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --bg-hover: #e5e5e5;
    --bg-input: #ffffff;
    --header-bg: #ffffff;
    --accent-primary: #2563eb;
    --accent-success: #16a34a;
    --accent-danger: #dc2626;
    --accent-warning: #d97706;
    --accent-orange: #ea580c;
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #737373;
    --border-color: #e5e5e5;
    --upvote: #ea580c;
    --downvote: #4f46e5;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header {
    position: sticky;
    top: 0;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    background: var(--accent-primary);
    color: #fff;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 1.1rem;
}

.logo-text { color: var(--text-primary); }

.nav { display: flex; gap: 4px; }

.nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.search-form { position: relative; }

.search-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 240px;
    transition: all 0.15s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    width: 300px;
}

.search-input::placeholder { color: var(--text-muted); }

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #2563eb;
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-block { width: 100%; justify-content: center; }

.btn-danger { background: var(--accent-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* User Menu */
.user-menu { position: relative; }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.user-avatar:hover { border-color: var(--accent-primary); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 180px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.15s;
    z-index: 200;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.1s;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}

@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .sidebar { display: none; }
}

/* Time Filter */
.time-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-link {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}

.filter-link:hover { color: var(--text-secondary); text-decoration: none; }
.filter-link.active { background: var(--bg-card); color: var(--text-primary); }

/* Bookmark Card */
.bookmark-list { display: flex; flex-direction: column; gap: 12px; }

.bookmark-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 16px;
    transition: border-color 0.15s;
}

.bookmark-card:hover { border-color: #3a3a3a; }

.vote-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 40px;
}

.vote-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}

.vote-btn:hover { background: var(--bg-hover); }
.vote-btn.upvote:hover, .vote-btn.upvote.active { color: var(--upvote); }
.vote-btn.downvote:hover, .vote-btn.downvote.active { color: var(--downvote); }
.vote-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.vote-score {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.bookmark-content { flex: 1; min-width: 0; }

.bookmark-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.bookmark-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.bookmark-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
    word-break: break-word;
}

.bookmark-title:hover { color: var(--accent-primary); }

.bookmark-domain {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bookmark-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.bookmark-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.tag {
    background: var(--bg-hover);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.15s;
}

.tag:hover {
    background: var(--accent-primary);
    color: #fff;
    text-decoration: none;
}

.tag-count {
    background: rgba(255,255,255,0.1);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    font-size: 0.7rem;
}

.bookmark-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.meta-user {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.meta-user:hover { color: var(--accent-primary); text-decoration: none; }

.meta-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.meta-comments { color: var(--text-muted); }
.meta-comments:hover { color: var(--text-secondary); text-decoration: none; }

.bookmark-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.15s;
}

.action-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }
.action-btn.active { color: var(--accent-primary); }

/* Admin action buttons */
.admin-hide-btn { color: #f59e0b; }
.admin-hide-btn:hover { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.admin-delete-btn { color: var(--accent-danger); }
.admin-delete-btn:hover { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); }
.admin-ban-btn { color: #dc2626; }
.admin-ban-btn:hover { background: rgba(220, 38, 38, 0.15); color: #dc2626; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p { margin-bottom: 20px; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 0;
}

.page-link {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
}

.page-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.page-info { color: var(--text-muted); font-size: 0.9rem; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.sidebar-card.cta-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #1a1a2e 100%);
    border-color: var(--accent-primary);
}

.sidebar-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.sidebar-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.sidebar-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.sidebar-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.user-list { display: flex; flex-direction: column; gap: 8px; }

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}

.user-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.user-item-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.user-item-name { flex: 1; font-size: 0.9rem; }
.user-item-count { font-size: 0.8rem; color: var(--text-muted); }

.muted { color: var(--text-muted); font-size: 0.85rem; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer-text {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Forms */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

/* Submit Page */
.page-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 24px;
}

.page-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
}

/* Profile Page */
.profile-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
}

.profile-info { flex: 1; }

.profile-name {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.profile-bio {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.profile-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.profile-stat strong {
    color: var(--text-primary);
}

.profile-actions {
    display: flex;
    gap: 8px;
}

/* Comments */
.comments-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 24px;
}

.comments-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.comment-form {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.comment-list { padding: 0; }

.comment {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.comment:last-child { border-bottom: none; }

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.comment-author {
    font-weight: 500;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.comment-content {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.tab {
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -5px;
    transition: all 0.15s;
}

.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Collections */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.collection-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    transition: all 0.15s;
}

.collection-card:hover {
    border-color: var(--accent-primary);
    text-decoration: none;
}

.collection-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.collection-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.collection-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
    .header { padding: 0 12px; }
    .header-left { gap: 8px; }
    .nav { display: none; }
    .search-input { width: 140px; }
    .search-input:focus { width: 180px; }

    .main-container { padding: 16px; }

    .bookmark-card {
        flex-direction: column;
        gap: 12px;
    }

    .vote-controls {
        flex-direction: row;
        justify-content: flex-start;
        order: 2;
    }

    .bookmark-actions {
        flex-direction: row;
        order: 3;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-stats { justify-content: center; }
    .profile-actions { justify-content: center; }
}

/* Footer */
.footer {
    margin-top: 60px;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

@media (max-width: 480px) {
    .footer-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}
