/* ================================================
   타임캡슐 페이지 스타일
   ================================================ */
.tc-page { max-width: 960px; margin: 0 auto; padding: 20px; }

/* 헤더 */
.tc-header { text-align: center; margin-bottom: 28px; }
.tc-header h2 { font-size: 1.6rem; font-weight: 700; color: #333; margin: 0 0 8px; }
.tc-header p { font-size: 0.95rem; color: #888; margin: 0; }

/* 탭 네비게이션 */
.tc-tabs { display: flex; gap: 0; margin-bottom: 24px; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.tc-tab { flex: 1; padding: 14px 16px; text-align: center; font-weight: 600; color: #888; cursor: pointer; border: none; background: transparent; font-size: 14px; transition: all 0.2s; border-bottom: 3px solid transparent; }
.tc-tab:hover { color: #e67e22; background: #fef9f3; }
.tc-tab.active { color: #e67e22; border-bottom-color: #e67e22; background: #fef9f3; }
.tc-tab i { margin-right: 6px; }

/* 탭 패널 */
.tc-panel { display: none; }
.tc-panel.active { display: block; }

/* 캡슐 카드 그리드 */
.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* 캡슐 카드 (개봉됨) */
.tc-card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; position: relative; overflow: hidden; }
.tc-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.tc-card .card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tc-card .mood-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.tc-card .card-meta { flex: 1; min-width: 0; }
.tc-card .card-meta .type-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 600; color: #fff; }
.tc-card .card-meta .author { font-size: 0.82rem; color: #999; margin-left: 6px; }
.tc-card .card-title { font-size: 1.02rem; font-weight: 600; color: #333; margin-bottom: 8px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-card .card-excerpt { font-size: 0.87rem; color: #777; line-height: 1.5; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tc-card .card-footer { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: #aaa; }
.tc-card .card-footer .stats { display: flex; gap: 12px; }
.tc-card .card-footer .stats i { margin-right: 3px; }

/* 봉인된 캡슐 카드 */
.tc-card.sealed { background: linear-gradient(135deg, #fdf6ed, #fff8f0); border: 2px dashed #e6c88e; }
.tc-card.sealed .card-title { color: #a88a5a; }
.tc-card.sealed .lock-overlay { position: absolute; top: 12px; right: 12px; }
.tc-card.sealed .countdown { font-size: 0.85rem; color: #c0792a; font-weight: 600; text-align: center; padding: 10px; background: rgba(230,126,34,0.08); border-radius: 8px; }

/* 상세 모달 */
.tc-modal-bg { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 9999; justify-content: center; align-items: center; padding: 20px; }
.tc-modal-bg.active { display: flex; }
.tc-modal { background: #fff; border-radius: 16px; max-width: 600px; width: 100%; max-height: 85vh; overflow-y: auto; position: relative; animation: tcSlideUp 0.3s ease; }
.tc-modal .modal-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: none; background: #f1f3f5; color: #666; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; z-index: 1; }
.tc-modal .modal-close:hover { background: #e2e6ea; }
.tc-modal .modal-header { padding: 24px 24px 0; }
.tc-modal .modal-header .type-badge { display: inline-block; padding: 4px 12px; border-radius: 6px; font-size: 0.78rem; font-weight: 600; color: #fff; margin-bottom: 8px; }
.tc-modal .modal-header h3 { font-size: 1.25rem; font-weight: 700; color: #333; margin: 0 0 8px; line-height: 1.4; }
.tc-modal .modal-header .meta { font-size: 0.85rem; color: #999; display: flex; gap: 12px; flex-wrap: wrap; }
.tc-modal .modal-body { padding: 20px 24px; }
.tc-modal .modal-body .content-text { font-size: 0.95rem; color: #444; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.tc-modal .modal-footer { padding: 16px 24px 24px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f0f0f0; }
.tc-modal .btn-like { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid #eee; border-radius: 8px; background: #fff; color: #999; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.tc-modal .btn-like:hover { border-color: #e74c3c; color: #e74c3c; }
.tc-modal .btn-like.liked { border-color: #e74c3c; color: #e74c3c; background: #fef0ef; }

/* 개봉 애니메이션 */
@keyframes tcSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes capsuleShake {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(-8deg); }
    20% { transform: rotate(8deg); }
    30% { transform: rotate(-6deg); }
    40% { transform: rotate(6deg); }
    50% { transform: rotate(-3deg); }
    60% { transform: rotate(3deg); }
    70% { transform: rotate(0deg); }
}

@keyframes capsuleOpen {
    0%   { transform: scale(1); opacity: 1; }
    30%  { transform: scale(1.15); }
    50%  { transform: scale(1.2); }
    70%  { transform: scale(0.95); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes capsuleBurst {
    0%   { opacity: 1; transform: scale(0); }
    50%  { opacity: 0.8; transform: scale(1.5); }
    100% { opacity: 0; transform: scale(2.5); }
}

@keyframes confettiFall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(120px) rotate(720deg); }
}

.capsule-opening { animation: capsuleShake 0.8s ease-in-out; }
.capsule-opened { animation: capsuleOpen 0.6s ease-out; }

.tc-open-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 10000; justify-content: center; align-items: center; flex-direction: column; }
.tc-open-overlay.active { display: flex; }
.tc-open-overlay .capsule-anim { font-size: 5rem; margin-bottom: 24px; }
.tc-open-overlay .burst-ring { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 3px solid #f39c12; animation: capsuleBurst 0.8s ease-out forwards; animation-delay: 0.8s; opacity: 0; }
.tc-open-overlay .open-text { font-size: 1.3rem; color: #fff; font-weight: 600; opacity: 0; transition: opacity 0.5s; }
.tc-open-overlay .open-text.show { opacity: 1; }

.confetti-piece { position: fixed; width: 10px; height: 10px; z-index: 10001; pointer-events: none; animation: confettiFall 1.5s ease-out forwards; }

/* 캡슐 만들기 폼 */
.tc-form-card { background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); max-width: 640px; margin: 0 auto; }
.tc-form-card h3 { font-size: 1.2rem; font-weight: 700; color: #333; margin: 0 0 20px; }
.tc-form-group { margin-bottom: 18px; }
.tc-form-group label { display: block; font-size: 0.88rem; color: #555; margin-bottom: 6px; font-weight: 600; }
.tc-form-group input,
.tc-form-group select,
.tc-form-group textarea { width: 100%; padding: 11px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem; box-sizing: border-box; font-family: inherit; transition: border-color 0.2s; }
.tc-form-group input:focus,
.tc-form-group select:focus,
.tc-form-group textarea:focus { border-color: #e67e22; outline: none; box-shadow: 0 0 0 3px rgba(230,126,34,0.1); }
.tc-form-group textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.tc-form-group .hint { font-size: 0.78rem; color: #aaa; margin-top: 4px; }

/* 기분 선택 */
.mood-selector { display: flex; gap: 10px; flex-wrap: wrap; }
.mood-option { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px; border: 2px solid #eee; border-radius: 10px; cursor: pointer; transition: all 0.2s; min-width: 70px; }
.mood-option:hover { border-color: #e67e22; background: #fef9f3; }
.mood-option.selected { border-color: #e67e22; background: #fef9f3; }
.mood-option .mood-emoji { font-size: 1.5rem; }
.mood-option .mood-text { font-size: 0.75rem; color: #888; font-weight: 500; }

/* 유형 선택 */
.type-selector { display: flex; gap: 10px; }
.type-option { flex: 1; padding: 14px; border: 2px solid #eee; border-radius: 10px; cursor: pointer; text-align: center; transition: all 0.2s; }
.type-option:hover { border-color: #e67e22; background: #fef9f3; }
.type-option.selected { border-color: #e67e22; background: #fef9f3; }
.type-option i { display: block; font-size: 1.3rem; margin-bottom: 6px; color: #999; }
.type-option.selected i { color: #e67e22; }
.type-option .type-name { font-size: 0.85rem; font-weight: 600; color: #555; }
.type-option .type-desc { font-size: 0.72rem; color: #aaa; margin-top: 3px; }

/* 공개 토글 */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #f8f9fa; border-radius: 10px; }
.toggle-row .toggle-label { font-size: 0.9rem; color: #555; }
.toggle-row .toggle-desc { font-size: 0.78rem; color: #aaa; }
.toggle-switch { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 26px; transition: 0.3s; }
.toggle-switch .slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .slider { background: #e67e22; }
.toggle-switch input:checked + .slider:before { transform: translateX(22px); }

.btn-capsule-submit { width: 100%; padding: 14px; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; color: #fff; background: linear-gradient(135deg, #e67e22, #f39c12); cursor: pointer; transition: opacity 0.2s, transform 0.2s; }
.btn-capsule-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(230,126,34,0.3); }
.btn-capsule-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* 내 캡슐 통계 */
.my-stats { display: flex; gap: 12px; margin-bottom: 24px; }
.my-stats .stat-box { flex: 1; text-align: center; padding: 16px 12px; background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.my-stats .stat-box .num { font-size: 1.4rem; font-weight: 700; }
.my-stats .stat-box .label { font-size: 0.78rem; color: #999; margin-top: 3px; }

/* 빈 상태 */
.tc-empty { text-align: center; padding: 60px 20px; background: #fff; border-radius: 15px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.tc-empty i { font-size: 3.5rem; color: #ddd; margin-bottom: 15px; display: block; }
.tc-empty p { color: #999; font-size: 1rem; margin: 0 0 16px; }
.tc-empty .btn-go { display: inline-block; padding: 10px 24px; background: #e67e22; color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.9rem; }

/* 페이지네이션 */
.tc-pagination { display: flex; justify-content: center; gap: 5px; margin-top: 24px; }
.tc-pagination button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: none; font-size: 0.9rem; cursor: pointer; background: #f1f3f5; color: #555; transition: all 0.2s; }
.tc-pagination button:hover { background: #e2e6ea; }
.tc-pagination button.active { background: #e67e22; color: #fff; font-weight: 600; }
.tc-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 로딩 */
.tc-loading { text-align: center; padding: 40px; color: #999; }
.tc-loading i { font-size: 1.5rem; margin-bottom: 10px; display: block; }

/* 곧 개봉 섹션 */
.upcoming-section { margin-bottom: 24px; }
.upcoming-section h4 { font-size: 1rem; font-weight: 600; color: #555; margin: 0 0 12px; }
.upcoming-list { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.upcoming-item { min-width: 220px; background: linear-gradient(135deg, #fff8f0, #fdf6ed); border: 1px solid #f0d9b5; border-radius: 12px; padding: 14px; flex-shrink: 0; }
.upcoming-item .up-mood { font-size: 1.3rem; margin-bottom: 6px; }
.upcoming-item .up-type { font-size: 0.72rem; color: #c0792a; font-weight: 600; }
.upcoming-item .up-countdown { font-size: 0.92rem; font-weight: 700; color: #e67e22; margin: 6px 0 2px; }
.upcoming-item .up-date { font-size: 0.78rem; color: #aaa; }

/* 개봉 가능 버튼 */
.btn-open-capsule { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; background: linear-gradient(135deg, #27ae60, #2ecc71); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 0.88rem; font-weight: 600; transition: all 0.2s; }
.btn-open-capsule:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(39,174,96,0.3); }

/* 반응형 */
@media (max-width: 768px) {
    .tc-page { padding: 15px; }
    .tc-grid { grid-template-columns: 1fr; }
    .tc-tabs { border-radius: 8px; }
    .tc-tab { padding: 12px 8px; font-size: 13px; }
    .tc-tab i { display: none; }
    .type-selector { flex-direction: column; }
    .my-stats { flex-wrap: wrap; }
    .my-stats .stat-box { min-width: calc(50% - 8px); }
    .mood-selector { justify-content: center; }
    .tc-modal { max-height: 90vh; border-radius: 12px; margin: 10px; }
    .upcoming-list { gap: 10px; }
    .upcoming-item { min-width: 180px; }
}
