/* CSS Variables for theming */
:root {
    /* Light theme colors */
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-light: #d1d5db;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #eff6ff;
    --accent-dark: #1e40af;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Global transitions for theme switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] {
    /* Dark theme colors */
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --border-light: #4b5563;
    --accent-primary: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-light: #1e3a8a;
    --accent-dark: #1e40af;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background-color: var(--bg-secondary);
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.nav-logo .logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: bold;
}

.nav-logo .logo-link i {
    color: #3b82f6;
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

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

.nav-link.active {
    color: var(--accent-primary);
    background-color: var(--accent-light);
}

.nav-link i {
    font-size: 1.25rem;
}

.nav-user .user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: none;
    border-radius: 0.375rem;
    background: none;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-user .user-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 0.375rem;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

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

.theme-toggle i {
    font-size: 1.25rem;
}

.nav-mobile {
    display: none;
}

.mobile-menu-btn {
    padding: 0.5rem;
    border: none;
    border-radius: 0.375rem;
    background: none;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    color: #1f2937;
    background-color: #f9fafb;
}

/* Main content */
.main-content {
    min-height: calc(100vh - 4rem);
    padding: 2rem 0;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #6b7280;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.stat-card i {
    font-size: 2rem;
    color: #3b82f6;
    margin-right: 1rem;
}

.stat-content .stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.stat-content .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1f2937;
}

.stat-card:nth-child(2) i {
    color: #ef4444;
}

.stat-card:nth-child(3) i {
    color: #f59e0b;
}

/* Content cards */
.content-card {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

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

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.view-all {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.view-all:hover {
    color: #2563eb;
}

/* Feeds list */
.feeds-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feed-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 0.5rem;
}

.feed-item-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.feed-item-left i {
    color: #3b82f6;
    font-size: 1.5rem;
}

.feed-item-content h3 {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.feed-item-content p {
    font-size: 0.875rem;
    color: #6b7280;
}

.feed-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feed-item-actions i {
    color: #ef4444;
    font-size: 1.25rem;
}

.feed-item-actions a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.feed-item-actions a:hover {
    color: #2563eb;
}

/* Recommendations list */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recommendation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: linear-gradient(to right, #eff6ff, #dbeafe);
    border-radius: 0.5rem;
}

.recommendation-item-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.recommendation-item-left i {
    color: #3b82f6;
    font-size: 1.5rem;
}

.recommendation-content h3 {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.recommendation-content p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.recommendation-category {
    display: inline-block;
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

/* Actions grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.action-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: #eff6ff;
    border-radius: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}

.action-card:hover {
    background-color: #dbeafe;
}

.action-card:nth-child(2) {
    background-color: #fef3c7;
}

.action-card:nth-child(2):hover {
    background-color: #fde68a;
}

.action-card:nth-child(2) i {
    color: #d97706;
}

.action-card i {
    font-size: 1.5rem;
    color: #3b82f6;
    margin-right: 0.75rem;
}

.action-card h3 {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.action-card p {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Forms */
.add-feed-form {
    max-width: 500px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 0.375rem;
    font-size: 1rem;
    background-color: var(--bg-secondary, white);
    color: var(--text-primary, #1f2937);
    transition: border-color 0.2s;
}

.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-help {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Profile Page */
.profile-form {
    max-width: 500px;
}

.profile-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.profile-actions .btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

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

.btn-secondary {
    background-color: #6b7280;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

/* Feed preview */
.feed-preview {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

/* Feed items */
.feed-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feed-item-detail {
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.feed-item-detail h3 {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.feed-item-detail p {
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.feed-item-meta {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Load more */
.load-more-container {
    text-align: center;
    margin-top: 1.5rem;
}

/* Loading spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.modal-content {
    background-color: var(--bg-secondary, white);
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-tertiary, #f3f4f6);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    color: var(--text-primary, #1f2937);
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .nav-mobile {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .feed-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .feed-item-actions {
        align-self: flex-end;
    }
    
    .recommendation-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .recommendation-item button {
        align-self: flex-end;
    }
}

/* Dark theme specific adjustments */
[data-theme="dark"] .feed-preview {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .feed-item-detail {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .recommendation-item {
    background: linear-gradient(to right, var(--accent-light), var(--bg-tertiary));
}

[data-theme="dark"] .action-card:nth-child(1) {
    background-color: var(--accent-light);
}

[data-theme="dark"] .action-card:nth-child(1):hover {
    background-color: var(--accent-dark);
}

[data-theme="dark"] .action-card:nth-child(2) {
    background-color: #451a03;
}

[data-theme="dark"] .action-card:nth-child(2):hover {
    background-color: #7c2d12;
}

[data-theme="dark"] .action-card:nth-child(2) i {
    color: #fbbf24;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
}

.empty-state i {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 1rem;
}
