@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --secondary: #10B981;
    --accent: #F59E0B;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --text: #1E293B;
    --text-secondary: #64748B;
    --border: #E2E8F0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1), 0 8px 30px rgba(0,0,0,0.08);
    --radius: 16px;
    --radius-sm: 10px;
}

body {
    font-family: 'Noto Sans SC', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.9);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* User Info Badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--bg);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-badge:hover {
    background: var(--border);
}

.user-badge .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.user-badge .user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-badge .user-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.user-badge .user-id {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

/* Hero Section */
.hero {
    padding: 40px 0;
    text-align: center;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 24px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    padding: 24px 0;
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.account-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.account-tabs {
    display: flex;
    margin-bottom: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.account-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.account-tab.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.account-form {
    display: none;
}

.account-form.active {
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--bg);
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.avatar-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    object-fit: cover;
}

.avatar-option:hover {
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.account-form .btn {
    width: 100%;
    justify-content: center;
}

.switch-link {
    text-align: center;
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.switch-link a {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

.switch-link a:hover {
    text-decoration: underline;
}

/* Posts List */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.post-meta {
    flex: 1;
}

.post-author {
    font-weight: 600;
    font-size: 0.95rem;
}

.post-account-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.post-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.post-content {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-images {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.post-images.single {
    grid-template-columns: 1fr;
}

.post-images.double {
    grid-template-columns: 1fr 1fr;
}

.post-images.triple {
    grid-template-columns: 1fr 1fr;
}

.post-images.triple .post-image:first-child {
    grid-column: span 2;
}

.post-image {
    width: 100%;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    object-fit: cover;
    max-height: 300px;
}

.post-image:hover {
    opacity: 0.9;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.post-action {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    border: none;
    background: transparent;
    font-family: inherit;
}

.post-action:hover {
    background: var(--bg);
    color: var(--primary);
}

.post-action svg {
    width: 18px;
    height: 18px;
}

/* Comments Section */
.comments-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: none;
}

.comments-section.open {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.comment-form {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.comment-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
}

.comment-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.2s ease;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    background: var(--bg);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
}

.comment-author {
    font-weight: 600;
    font-size: 0.85rem;
}

.comment-text {
    font-size: 0.9rem;
    margin-top: 4px;
}

.comment-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.comment-reply-btn {
    font-size: 0.75rem;
    color: var(--primary);
    cursor: pointer;
    margin-top: 6px;
    border: none;
    background: transparent;
    font-family: inherit;
}

.comment-reply-btn:hover {
    text-decoration: underline;
}

.nested-comments {
    margin-left: 42px;
    margin-top: 10px;
    padding-left: 16px;
    border-left: 2px solid var(--border);
}

.reply-form {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.reply-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
}

.reply-form input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s;
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--border);
}

.modal-body {
    padding: 20px;
}

.post-modal textarea {
    width: 100%;
    min-height: 150px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 16px;
}

.post-modal textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.image-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.image-upload-area:hover,
.image-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.image-upload-area svg {
    width: 40px;
    height: 40px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.image-upload-area p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.image-preview {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    cursor: zoom-out;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.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); }
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    background: var(--text);
    color: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--secondary);
}

.toast.error {
    background: #EF4444;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 600px) {
    .header-inner {
        padding: 12px 16px;
    }

    .logo-text {
        display: none;
    }

    .user-badge .user-info {
        display: none;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .stats {
        gap: 20px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .post-card {
        padding: 16px;
    }

    .post-avatar {
        width: 36px;
        height: 36px;
    }

    .modal {
        max-height: 100vh;
        border-radius: var(--radius) var(--radius) 0 0;
        position: fixed;
        bottom: 0;
    }
}
