/**
 * HuSNS Mobile Theme Stylesheet
 * 简洁高效的移动端界面
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #1da1f2;
    --primary-dark: #1a91da;
    --bg-color: #fff;
    --bg-secondary: #f7f9fa;
    --text-primary: #14171a;
    --text-secondary: #657786;
    --text-muted: #aab8c2;
    --border-color: #e1e8ed;
    --danger-color: #e0245e;
    --success-color: #17bf63;
    --warning-color: #ffad1f;
}

.dark-mode {
    --primary-color: #1da1f2;
    --primary-dark: #1a91da;
    --bg-color: #15202b;
    --bg-secondary: #192734;
    --text-primary: #ffffff;
    --text-secondary: #8899a6;
    --text-muted: #657786;
    --border-color: #38444d;
    --danger-color: #e0245e;
    --success-color: #17bf63;
    --warning-color: #ffad1f;
}

html, body {
    height: 100%;
}

body.mobile-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 15px;
    overflow-x: hidden;
}

.m-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.m-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 15px;
}

.m-header-back {
    font-size: 20px;
    color: var(--primary-color);
    text-decoration: none;
    padding: 10px;
    margin-left: -10px;
}

.m-header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

.m-header-right {
    width: 40px;
    text-align: right;
}

.m-header-right a, .m-header-right button {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
}

.m-main {
    padding-top: 50px;
    padding-bottom: 60px;
    min-height: 100vh;
}

.m-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.m-tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    position: relative;
}

.m-tabbar-item.active {
    color: var(--primary-color);
}

.m-tabbar-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.m-tabbar-label {
    font-size: 10px;
}

.m-tabbar-publish {
    flex: 1;
}

.m-tabbar-icon-publish {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
}

.m-tabbar-badge {
    position: absolute;
    top: 5px;
    right: 50%;
    transform: translateX(15px);
    background: var(--danger-color);
    color: #fff;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.m-toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 200;
    animation: slideDown 0.3s ease;
}

.m-toast-success {
    background: var(--success-color);
    color: #fff;
}

.m-toast-error {
    background: var(--danger-color);
    color: #fff;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.m-post-list {
    background: var(--bg-color);
}

.m-post-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.m-post-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.m-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.m-post-user-info {
    flex: 1;
}

.m-post-username {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 15px;
}

.m-post-time {
    font-size: 12px;
    color: var(--text-muted);
}

.m-post-content {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 10px;
    word-break: break-word;
}

.m-post-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.m-post-images {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
    border-radius: 12px;
    overflow: hidden;
}

.m-post-images.single {
    max-width: 200px;
}

.m-post-images.double {
    grid-template-columns: repeat(2, 1fr);
}

.m-post-images.triple {
    grid-template-columns: repeat(3, 1fr);
}

.m-post-images.quad {
    grid-template-columns: repeat(2, 1fr);
}

.m-post-images.many {
    grid-template-columns: repeat(3, 1fr);
}

.m-post-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.m-post-actions {
    display: flex;
    justify-content: space-around;
    padding-top: 8px;
}

.m-action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 20px;
    background: none;
    border: none;
    cursor: pointer;
}

.m-action-btn:active {
    background: var(--bg-secondary);
}

.m-action-btn.liked {
    color: var(--danger-color);
}

.m-action-btn.favorited {
    color: var(--warning-color);
}

.m-action-icon {
    font-size: 16px;
}

.m-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.m-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.m-empty-text {
    font-size: 14px;
}

.m-login-page {
    padding: 40px 20px;
    text-align: center;
}

.m-login-logo {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 40px;
}

.m-form-group {
    margin-bottom: 15px;
    text-align: left;
}

.m-form-input {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-color);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.m-form-input:focus {
    border-color: var(--primary-color);
}

.m-form-input::placeholder {
    color: var(--text-muted);
}

.m-btn {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.m-btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.m-btn-primary:active {
    background: var(--primary-dark);
}

.m-btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.m-btn-block {
    display: block;
    width: 100%;
}

.m-link {
    color: var(--primary-color);
    text-decoration: none;
}

.m-divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
}

.m-divider::before,
.m-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.m-divider-text {
    padding: 0 15px;
    color: var(--text-muted);
    font-size: 13px;
}

.m-publish-page {
    padding: 15px;
}

.m-publish-textarea {
    width: 100%;
    min-height: 150px;
    border: none;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    background: var(--bg-color);
    color: var(--text-primary);
}

.m-publish-textarea::placeholder {
    color: var(--text-muted);
}

.m-publish-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.m-publish-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
}

.m-publish-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.m-publish-image-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.m-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 12px;
    padding: 4px;
    text-align: center;
}

.m-publish-add-image {
    aspect-ratio: 1;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
}

.m-publish-add-icon {
    font-size: 28px;
    margin-bottom: 5px;
}

.m-publish-add-text {
    font-size: 12px;
}

.m-publish-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 15px;
}

.m-publish-tools {
    display: flex;
    gap: 15px;
}

.m-publish-tool {
    font-size: 22px;
    color: var(--primary-color);
    cursor: pointer;
}

.m-publish-submit {
    padding: 10px 25px;
}

.m-profile-header {
    padding: 20px 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.m-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 10px;
}

.m-profile-username {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 5px;
}

.m-profile-bio {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.m-profile-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.m-profile-stat {
    text-align: center;
}

.m-profile-stat-num {
    font-size: 18px;
    font-weight: 700;
}

.m-profile-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.m-menu-list {
    background: var(--bg-color);
    margin-top: 10px;
}

.m-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
}

.m-menu-item:active {
    background: var(--bg-secondary);
}

.m-menu-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.m-menu-icon {
    font-size: 20px;
}

.m-menu-text {
    font-size: 15px;
}

.m-menu-arrow {
    color: var(--text-muted);
    font-size: 14px;
}

.m-comment-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.m-comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.m-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 8px;
}

.m-comment-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.m-comment-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.m-comment-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-left: 40px;
}

.m-comment-input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 15px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.m-comment-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
}

.m-comment-input button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.m-detail-page {
    padding-bottom: 70px;
}

.m-load-more {
    text-align: center;
    padding: 15px;
    color: var(--text-muted);
    font-size: 14px;
}

.m-pull-refresh {
    text-align: center;
    padding: 15px;
    color: var(--text-muted);
    font-size: 14px;
}

.m-tabs {
    display: flex;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 50px;
    z-index: 50;
}

.m-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.m-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.m-notification-item {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
}

.m-notification-item.unread {
    background: rgba(29, 161, 242, 0.05);
}

.m-notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.m-notification-item .avatar-default,
.m-notification-item img {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    flex-shrink: 0;
}

.m-notification-content {
    flex: 1;
}

.m-notification-title {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.m-notification-time {
    font-size: 12px;
    color: var(--text-muted);
}

.m-repost-preview {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.dark-mode .m-post-images,
.dark-mode .m-publish-image-item {
    background: var(--bg-secondary);
}

.emoji-img-inline {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    display: inline-block;
    margin: -2px 2px 0;
}

.m-post-content a,
.m-comment-content a {
    color: var(--primary-color);
    text-decoration: none;
}

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