/**
 * Components CSS
 * 通用 UI 組件樣式
 */

/* ========================================
   Not Found Page (404)
======================================== */
.not-found-page {
    text-align: center;
    padding: 80px 24px;
}

.not-found-page .material-icons {
    font-size: 1.6rem;
    color: var(--paws-card);
}

.not-found-page h1 {
    font-size: 24px;
    margin: 16px 0 8px;
}

.not-found-page p {
    color: var(--paws-text-muted);
    margin-bottom: 24px;
}

.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--paws-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-weight: 500;
    text-decoration: none;
}

.back-home-btn:hover {
    background: var(--paws-primary-dark, #5558e3);
    color: white;
}

/* ========================================
   Profile Tabs
======================================== */
.profile-tabs {
    display: flex;
    border-top: 1px solid var(--paws-border);
    border-bottom: 1px solid var(--paws-border);
    background: var(--paws-card);
    position: sticky;
    top: 56px;
    z-index: 10;
}

.profile-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--paws-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.profile-tab:hover {
    color: var(--paws-primary);
    background: rgba(99, 102, 241, 0.08);
}

.profile-tab.active {
    color: var(--paws-primary);
    border-bottom-color: var(--paws-primary);
}

.profile-tab .material-icons {
    font-size: 20px;
}

.profile-tab .tab-count {
    font-size: 11px;
    background: var(--paws-bg);
    padding: 2px 6px;
    border-radius: 10px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

@media (min-width: 768px) {
    .profile-tabs {
        position: relative;
        top: 0;
        border-radius: 12px;
        border: 1px solid var(--paws-border);
    }
}

/* ========================================
   Profile Stats
======================================== */
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 12px 0;
    border-top: 1px solid var(--paws-border);
    border-bottom: 1px solid var(--paws-border);
    margin-bottom: 12px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--paws-text);
}

.stat-label {
    font-size: 11px;
    color: var(--paws-text-muted);
}

/* ========================================
   Photo Gallery (Grid)
======================================== */
.photo-gallery-section {
    padding: 24px 16px;
    border-top: 8px solid var(--paws-bg);
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--paws-bg);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item > a:first-child {
    display: block;
    width: 100%;
    height: 100%;
}

/* 瀏覽日記連結按鈕 */
.view-diary-link {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.view-diary-link:hover {
    background: var(--paws-primary);
    transform: scale(1.1);
}

.view-diary-link .material-icons {
    font-size: 18px;
    color: var(--paws-primary);
}

.view-diary-link:hover .material-icons {
    color: white;
}

/* 影片項目的瀏覽日記按鈕放左下角，避免與時長重疊 */
.video-item .view-diary-link {
    left: 8px;
    right: auto;
}

/* ========================================
   Video Gallery
======================================== */
.video-gallery-section {
    padding: 24px 16px;
    border-top: 8px solid var(--paws-bg);
}

.video-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.video-item {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--paws-bg);
}

.video-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.video-item img,
.video-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.video-overlay .material-icons {
    color: white;
    font-size: 32px;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ========================================
   Empty State
======================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: var(--paws-card);
    border-radius: 16px;
}

.empty-state .material-icons {
    font-size: 48px;
    color: var(--paws-text-muted);
}

.empty-state p {
    color: var(--paws-text-muted);
    margin: 12px 0 0;
}

.empty-state .btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--paws-primary);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

/* ========================================
   Section Header
======================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.section-title .material-icons {
    color: var(--paws-primary);
}

.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--paws-primary);
    color: white;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.add-btn .material-icons {
    font-size: 16px;
}

/* ========================================
   Pull to Refresh (PWA 下拉刷新)
======================================== */
.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transform: translateY(0);
    transition: opacity 0.2s ease;
}

.pull-refresh-indicator.visible {
    opacity: 1;
}

.pull-refresh-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--paws-card, #fff);
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 10px;
}

.pull-refresh-icon {
    font-size: 22px;
    color: var(--paws-primary, #6366f1);
    transition: transform 0.2s ease;
}

.pull-refresh-icon.spinning {
    animation: spin 1s linear infinite;
}

.pull-refresh-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--paws-text, #333);
}

.pull-refresh-indicator.ready .pull-refresh-content {
    background: var(--paws-primary, #6366f1);
}

.pull-refresh-indicator.ready .pull-refresh-icon,
.pull-refresh-indicator.ready .pull-refresh-text {
    color: #fff;
}

.pull-refresh-indicator.refreshing .pull-refresh-content {
    background: var(--paws-primary, #6366f1);
}

.pull-refresh-indicator.refreshing .pull-refresh-icon,
.pull-refresh-indicator.refreshing .pull-refresh-text {
    color: #fff;
}

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