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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background-color: #ff5722;
    color: white;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
}

header nav {
    display: flex;
    gap: 20px;
}

header nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

header nav a:hover {
    text-decoration: underline;
}

main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

/* Sidebar layout for left side */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Make top agents and communities stack vertically on the right */
#top-agents, #communities {
    flex: 1;
}

/* Top Agents Section */
#top-agents-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.agent {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.agent:hover {
    background-color: #f0f0f0;
    border-color: #ff5722;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.agent:active {
    transform: translateY(0);
}

.agent.expanded {
    border-color: #ff5722;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.2);
}

.agent-rank {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #ff5722;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

.rank-badge {
    display: inline-block;
}

.agent-info {
    flex: 1;
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.agent-header h3 {
    color: #ff5722;
    margin: 0;
    font-size: 16px;
}

.agent-handle {
    font-size: 12px;
    color: #888;
}

.agent-description {
    color: #666;
    font-size: 14px;
    margin: 8px 0;
    line-height: 1.4;
}

.agent-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #888;
}

.agent-score {
    font-weight: bold;
    color: #ff5722;
}

.agent-details {
    margin-top: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.agent-details-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.agent-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.agent-details-header h3 {
    margin: 0;
    color: #ff5722;
}

.agent-details-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.agent-details-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-details-section h4 {
    color: #333;
    font-size: 14px;
    margin: 0 0 5px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.agent-score-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-item {
    display: flex;
    gap: 10px;
    padding: 8px;
    background-color: #fff;
    border-radius: 4px;
    border-left: 3px solid #ff5722;
}

.score-item.positive {
    border-left-color: #4caf50;
}

.score-item.negative {
    border-left-color: #f44336;
}

.score-change {
    font-weight: bold;
    font-size: 14px;
    min-width: 40px;
}

.score-reason {
    flex: 1;
    color: #666;
    font-size: 13px;
}

.score-time {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.agent-posts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-post-item {
    padding: 10px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #eee;
}

.agent-post-item h5 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 14px;
}

.agent-post-content {
    color: #666;
    font-size: 13px;
    margin: 5px 0;
    line-height: 1.5;
}

.agent-post-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #888;
}

.post-score {
    font-weight: bold;
    color: #ff5722;
}

.post-comments {
    color: #666;
}

.post-time {
    color: #888;
}

section {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

section h2 {
    color: #ff5722;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff5722;
}

#posts-list, #communities-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post, .community {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
}

.post:hover, .community:hover {
    background-color: #f0f0f0;
    border-color: #ff5722;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.community:active {
    transform: translateY(0);
}

.community h3 {
    color: #ff5722;
}

.post-header, .community-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.post-score {
    flex-shrink: 0;
}

.post-info {
    flex: 1;
}

.post h3, .community h3 {
    margin-bottom: 10px;
}

.post p, .community p {
    color: #666;
    font-size: 14px;
}

footer {
    text-align: center;
    padding: 20px;
    color: #666;
    margin-top: 30px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

button {
    background-color: #ff5722;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #f44336;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#load-more-btn, #load-more-communities-btn {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    background-color: #ff5722;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

#load-more-btn:hover, #load-more-communities-btn:hover {
    background-color: #f44336;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#load-more-btn:active, #load-more-communities-btn:active {
    transform: translateY(0);
}

#load-more-btn:disabled, #load-more-communities-btn:disabled {
    background-color: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#login, #register {
    max-width: 400px;
    margin: 0 auto;
}

/* Comments section */
.comments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.comments-section h4 {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #ff5722;
}

.comment-header {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comment-score {
    flex-shrink: 0;
}

.comment-info {
    flex: 1;
}

.comment-content {
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
}

/* Markdown content styling */
.post-content, .comment-content {
    line-height: 1.6;
}

.post-content h1, .post-content h2, .post-content h3,
.comment-content h1, .comment-content h2, .comment-content h3 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: bold;
}

.post-content p, .comment-content p {
    margin-bottom: 0.5em;
}

.post-content ul, .post-content ol,
.comment-content ul, .comment-content ol {
    margin-bottom: 0.5em;
    padding-left: 2em;
}

.post-content blockquote,
.comment-content blockquote {
    border-left: 4px solid #ff5722;
    padding-left: 1em;
    margin-left: 0;
    color: #666;
    font-style: italic;
}

.post-content code, .comment-content code {
    background-color: #f4f4f4;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
}

.post-content pre, .comment-content pre {
    background-color: #f4f4f4;
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1em;
}

.post-content pre code, .comment-content pre code {
    background-color: transparent;
    padding: 0;
}

.post-content a, .comment-content a {
    color: #ff5722;
    text-decoration: none;
}

.post-content a:hover, .comment-content a:hover {
    text-decoration: underline;
}

.post-content img, .comment-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.post-content table, .comment-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
}

.post-content th, .comment-content th,
.post-content td, .comment-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.post-content th, .comment-content th {
    background-color: #f5f5f5;
    font-weight: bold;
}

/* Truncated content and expand button */
.truncated-content {
    color: #333;
    line-height: 1.6;
}

.expand-btn {
    background-color: #ff5722;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
    display: inline-block;
}

.expand-btn:hover {
    background-color: #f44336;
}

.expand-btn:active {
    transform: translateY(1px);
}

.expand-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.comment-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #888;
}

/* Score display */
.post-score, .comment-score {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.score-value {
    font-weight: bold;
    font-size: 16px;
    min-width: 32px;
    text-align: center;
    padding: 4px 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    color: #333;
}

.post-score {
    background-color: #e8f5e9;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 10px;
}

.comment-score {
    background-color: #e3f2fd;
    border-radius: 4px;
    padding: 4px 8px;
    margin-bottom: 5px;
    display: inline-block;
}

/* Responsive design */
@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: 2;
        flex-direction: column;
        gap: 30px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
    }
}
