/* General Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: #f0f2f5;
    color: #262626;
    line-height: 1.6;
}

/* App Header */
header {
    background-color: #ffffff;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: #1890ff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: #1890ff;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #40a9ff;
}

.btn-secondary {
    background-color: #f5f5f5;
    color: #595959;
    border: 1px solid #d9d9d9;
}

.btn-secondary:hover {
    background-color: #e8e8e8;
    color: #262626;
}

.btn-danger {
    background-color: #ff4d4f;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #ff7875;
}

.btn-text {
    background: transparent;
    color: #595959;
    padding: 6px 12px;
}

.btn-text:hover {
    background-color: #f5f5f5;
    color: #262626;
}

/* Layout Main */
main {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* Left Content - Feed */
.feed-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feed-header {
    background: #ffffff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-title {
    font-size: 18px;
    font-weight: 600;
}

/* Post Cards */
.post-card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.post-card-image-wrapper {
    width: 100%;
    height: 360px;
    overflow: hidden;
    background-color: #fafafa;
    position: relative;
}

.post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-content {
    padding: 16px;
}

.post-meta {
    font-size: 12px;
    color: #8c8c8c;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.post-tag {
    background-color: #e6f7ff;
    color: #1890ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.post-tag.solved {
    background-color: #f6ffed;
    color: #52c41a;
}

.post-title {
    font-size: 18px;
    font-weight: bold;
    color: #262626;
    margin-bottom: 8px;
}

.post-desc {
    font-size: 14px;
    color: #595959;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #8c8c8c;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    padding: 20px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #262626;
}

.sidebar-desc {
    font-size: 13px;
    color: #595959;
    margin-bottom: 16px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background-color: #ffffff;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    animation: modal-anim 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes modal-anim {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    color: #bfbfbf;
    cursor: pointer;
    background: none;
    border: none;
}

.modal-close:hover {
    color: #595959;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Forms inside Modals */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #262626;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: #40a9ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
    outline: none;
}

.form-error {
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* Upload Style */
.upload-drag-area {
    border: 2px dashed #d9d9d9;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.upload-drag-area:hover, .upload-drag-area.dragover {
    border-color: #1890ff;
}

.upload-drag-area img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    margin-top: 10px;
    display: none;
}

.upload-icon {
    font-size: 32px;
    color: #1890ff;
    margin-bottom: 8px;
}

/* Post Detail Specific UI (Double Column inside Modal Body) */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}

@media (max-width: 768px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-image-wrapper {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #fafafa;
}

.detail-image {
    width: 100%;
    display: block;
    object-fit: contain;
    max-height: 500px;
}

.detail-title {
    font-size: 22px;
    font-weight: bold;
    color: #262626;
}

.detail-desc {
    font-size: 15px;
    color: #595959;
    white-space: pre-line;
    background: #fafafa;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.detail-guesses-title {
    font-size: 16px;
    font-weight: bold;
    border-top: 1px solid #f0f0f0;
    padding-top: 16px;
    margin-top: 8px;
}

/* Guess Comments Section */
.guesses-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.guess-item {
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 12px;
    position: relative;
}

.guess-item.correct {
    border-color: #b7eb8f;
    background-color: #f6ffed;
}

.guess-meta {
    font-size: 12px;
    color: #8c8c8c;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.guess-text {
    font-size: 14px;
    color: #262626;
}

.guess-badge {
    display: inline-block;
    background-color: #52c41a;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

/* Detail Right Panel - Actions and Solving */
.detail-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-actions-box {
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 16px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #000000e0;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 2000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast-success {
    background-color: #52c41a;
}

.toast-error {
    background-color: #ff4d4f;
}

/* Loading overlay */
.loading-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7);
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1890ff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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