/* ===== 基本設定 ===== */
:root {
    --primary-color: #000000;
    --secondary-color: #6c757d;
    --accent-color: #0095f6;
    --danger-color: #dc3545;
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --border-color: #dbdbdb;
    --text-primary: #262626;
    --text-secondary: #8e8e8e;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ===== 導航列 ===== */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar .btn-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 1rem;
}

.navbar .btn-link:hover {
    color: rgba(255,255,255,1);
}

/* ===== 卡片樣式 ===== */
.card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-bg);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post-card {
    margin-bottom: 1.5rem;
}

@media (max-width: 576px) {
    .post-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ===== 頭像圓圈 ===== */
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    text-transform: uppercase;
}

@media (max-width: 576px) {
    .avatar-circle {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

/* ===== 貼文內容 ===== */
.post-content {
    font-size: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.post-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    display: block;
}

.post-image:hover {
    transform: scale(1.02);
}

@media (max-width: 576px) {
    .post-image {
        border-radius: 4px;
    }
}

/* ===== 貼文操作按鈕 ===== */
.post-actions {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.post-actions .btn {
    border-radius: 8px;
    transition: all 0.2s;
}

.post-actions .btn:hover {
    background-color: rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

.like-btn {
    position: relative;
}

.like-count {
    margin-left: 0.25rem;
}

/* ===== 評論區域 ===== */
.comments-section {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.comment-item {
    padding: 0.75rem;
    background-color: white;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.comment-item:last-child {
    margin-bottom: 0;
}

.comment-form {
    margin-top: 1rem;
}

.comment-input {
    border-radius: 20px;
}

@media (max-width: 576px) {
    .comments-section {
        padding: 0.75rem;
        border-radius: 0;
    }

    .comment-item {
        padding: 0.5rem;
    }
}

/* ===== 表單樣式 ===== */
.form-control:focus,
.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0,0,0,0.1);
}

.btn-dark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-dark:hover {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-outline-secondary {
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-outline-danger {
    border-radius: 8px;
    transition: all 0.2s;
}

/* ===== 登入/註冊頁面 ===== */
.card-body {
    padding: 2rem;
}

@media (max-width: 576px) {
    .card-body {
        padding: 1.5rem;
    }

    .card-body.p-5 {
        padding: 2rem !important;
    }
}

/* ===== Footer ===== */
.footer {
    margin-top: auto;
}

/* ===== 響應式間距 ===== */
@media (max-width: 576px) {
    .container {
        padding-left: 0;
        padding-right: 0;
    }

    main .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    h2, h3 {
        font-size: 1.5rem;
    }
}

/* ===== 動畫效果 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeIn 0.3s ease;
}

.comment-item {
    animation: fadeIn 0.2s ease;
}

/* ===== 載入狀態 ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ===== 空狀態 ===== */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-secondary);
}

/* ===== 平板裝置 ===== */
@media (min-width: 577px) and (max-width: 991px) {
    .avatar-circle {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .navbar-brand {
        font-size: 1.3rem;
    }
}

/* ===== 大螢幕 ===== */
@media (min-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

/* ===== 無障礙改善 ===== */
.btn:focus-visible,
.form-control:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== 深色模式支援（預留） ===== */
@media (prefers-color-scheme: dark) {
    /* 未來可以添加深色模式樣式 */
}

/* ===== 列印樣式 ===== */
@media print {
    .navbar,
    .footer,
    .post-actions,
    .comment-form,
    .btn {
        display: none !important;
    }

    .card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
