/* 기본 스타일 및 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FFD600;
    --primary-dark: #E6C200;
    --secondary-color: #333333;
    --text-color: #333333;
    --text-light: #666666;
    --bg-color: #F5F5F5;
    --card-bg: #FFFFFF;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 80px;
    overflow-x: hidden;
}

/* 헤더 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--secondary-color);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

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

.logo {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.user-info {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

.nickname {
    font-weight: 500;
}

/* 메인 컨텐츠 */
.main-content {
    max-width: 1200px;
    margin: 80px auto 0;
    padding: 20px;
    min-height: calc(100vh - 160px);
}

/* 탭 시스템 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.tab-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.ranking-subtitle {
    font-size: 14px;
    color: var(--text-light);
    width: 100%;
    margin-top: -10px;
}

.btn-write {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-write:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-write i {
    margin-right: 6px;
}

/* 게시물 컨테이너 */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 갤러리 레이아웃 (인증샷) */
.posts-container.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 게시물 카드 */
.post-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

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

.post-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-author i {
    color: var(--primary-color);
}

.author-name {
    font-weight: 600;
    font-size: 15px;
}

.post-date {
    font-size: 12px;
    color: var(--text-light);
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #FFE5E5;
    color: #FF4444;
}

/* 랭킹 뱃지 */
.ranking-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--secondary-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--shadow);
}

.post-content {
    color: var(--text-color);
    margin-bottom: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 인증샷 이미지 */
.post-image {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    max-height: 400px;
    object-fit: cover;
}

.post-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.hashtag {
    background: var(--primary-color);
    color: var(--secondary-color);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.btn-like {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-like:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.btn-like.liked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-like i {
    color: #FF4444;
}

.like-count {
    font-weight: 700;
}

/* 하단 네비게이션 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 8px 20px;
    transition: all 0.3s ease;
    flex: 1;
}

.nav-item i {
    font-size: 20px;
}

.nav-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item:hover {
    color: var(--primary-dark);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-in;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

/* 폼 스타일 */
form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.required {
    color: #FF4444;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Noto Sans KR', sans-serif;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 214, 0, 0.1);
}

.form-control[readonly] {
    background: var(--bg-color);
    color: var(--text-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--secondary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* 로딩 스피너 */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 300;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    margin-top: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .tab-header h2 {
        font-size: 20px;
    }

    .btn-write {
        padding: 10px 20px;
        font-size: 14px;
    }

    .posts-container.gallery {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }

    .post-card {
        padding: 16px;
    }

    .modal-content {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }

    .user-info {
        font-size: 12px;
        padding: 6px 12px;
    }

    .posts-container.gallery {
        grid-template-columns: 1fr;
    }

    .nav-item {
        font-size: 11px;
        padding: 8px 12px;
    }

    .nav-item i {
        font-size: 18px;
    }
}
