/**
 * Douyin Mobile Styles - 移动端样式
 * Matching the exact Douyin app design
 */

/* ===== App Container ===== */
.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ===== Top Navigation ===== */
.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: calc(var(--safe-area-top) + 40px) var(--spacing-lg) var(--spacing-lg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-sticky);
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
}

.nav-tabs {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-tab {
    font-size: var(--font-lg);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 4px;
    position: relative;
    transition: all var(--transition-normal);
    font-weight: 500;
}

.nav-tab:hover {
    color: rgba(255, 255, 255, 0.85);
}

.nav-tab.active {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 17px;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
}

.search-icon {
    position: absolute;
    right: var(--spacing-lg);
    top: calc(var(--safe-area-top) + 40px);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.search-icon:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
}

.search-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--text-primary);
}

.live-icon {
    position: absolute;
    left: var(--spacing-lg);
    top: calc(var(--safe-area-top) + 40px);
}

/* ===== Video Container ===== */
.video-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.video-wrapper {
    width: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    contain: layout style paint;
}

.video-item {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    will-change: auto;
    transform: translate3d(0, 0, 0);
    contain: layout style paint;
}

.video-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translateZ(0);
}

.video-item.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--douyin-pink);
    border-right-color: var(--douyin-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 100;
}

/* ===== Pause Icon ===== */
.pause-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform var(--transition-bounce);
}

.pause-icon.show {
    transform: translate(-50%, -50%) scale(1);
}

.pause-icon::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 14px 0 14px 24px;
    border-color: transparent transparent transparent var(--text-primary);
    margin-left: 4px;
}

/* ===== Right Interaction Bar ===== */
.interaction-bar {
    position: absolute;
    right: 8px;
    bottom: calc(var(--bottom-nav-height, 56px) + var(--safe-area-bottom, 0px) + 80px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: var(--z-dropdown);
}

.interaction-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform var(--transition-bounce);
}

.interaction-item:active {
    transform: scale(0.85);
}

.interaction-item .icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.interaction-item .icon svg {
    width: 32px;
    height: 32px;
    fill: var(--text-primary);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transition: all var(--transition-bounce);
}

.interaction-item:hover .icon svg {
    transform: scale(1.1);
}

.interaction-item.liked .icon {
    animation: heartBeat 0.5s ease;
}

.interaction-item.liked .icon svg {
    fill: var(--douyin-pink);
    filter: drop-shadow(0 0 12px rgba(254, 44, 85, 0.6));
}

.interaction-item .count {
    font-size: var(--font-sm);
    color: var(--text-primary);
    margin-top: 2px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.interaction-item.liked .count {
    color: var(--douyin-pink);
}

/* Bookmark/Saved state */
.interaction-item.saved .icon svg {
    fill: #ffc107;
    filter: drop-shadow(0 0 8px rgba(255, 193, 7, 0.5));
}

.interaction-item.saved .count {
    color: #ffc107;
}

/* ===== Avatar ===== */
.avatar-container {
    position: relative;
    margin-bottom: 8px;
    cursor: pointer;
}

.avatar-container:active {
    transform: scale(0.9);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--text-primary);
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.follow-btn {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    background: var(--douyin-pink);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-primary);
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(254, 44, 85, 0.5);
    transition: all var(--transition-bounce);
    cursor: pointer;
}

.follow-btn:active {
    transform: translateX(-50%) scale(0.85);
}

/* ===== Bottom Info ===== */
.video-info {
    position: absolute;
    left: 12px;
    right: 70px;
    bottom: calc(var(--bottom-nav-height, 56px) + var(--safe-area-bottom, 0px) + 40px);
    z-index: var(--z-dropdown);
    animation: slideUp 0.4s ease-out;
}

.username {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.description {
    font-size: var(--font-md);
    color: var(--text-primary);
    line-height: 1.4;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.description.expanded {
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* ===== Music Info ===== */
.music-info {
    display: flex;
    align-items: center;
    margin-top: 10px;
    max-width: 200px;
}

.music-icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
}

.music-text {
    font-size: var(--font-sm);
    color: var(--text-primary);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

/* ===== Music Disc ===== */
.music-disc {
    position: absolute;
    right: 8px;
    bottom: calc(var(--bottom-nav-height, 56px) + var(--safe-area-bottom, 0px) + 40px);
    width: 48px;
    height: 48px;
    z-index: var(--z-dropdown);
}

.disc-container {
    width: 100%;
    height: 100%;
    position: relative;
    animation: rotateDisc 5s linear infinite;
}

.video-item.paused .disc-container {
    animation-play-state: paused;
}

.disc-bg {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
    border-radius: 50%;
    position: absolute;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.disc-cover {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.disc-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Bottom Navigation - Douyin Style ===== */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.95) 100%);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: var(--z-sticky);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px 16px;
    transition: all var(--transition-fast);
    min-width: 48px;
}

.nav-item:active {
    transform: scale(0.9);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    fill: var(--text-secondary);
    transition: all var(--transition-fast);
}

.nav-item.active svg {
    fill: var(--text-primary);
}

.nav-item span {
    font-size: var(--font-xs);
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 500;
}

.nav-item.active span {
    color: var(--text-primary);
    font-weight: 600;
}

/* Center Add Button - Douyin Style */
.nav-add {
    position: relative;
    width: 44px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-add-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-add-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

.nav-add-bg-left {
    background: var(--douyin-cyan);
    left: -3px;
    z-index: 1;
}

.nav-add-bg-right {
    background: var(--douyin-pink);
    right: -3px;
    z-index: 0;
}

.nav-add-center {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--text-primary);
    border-radius: 6px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
}

.nav-add-center svg {
    width: 20px;
    height: 20px;
    fill: var(--bg-primary) !important;
}

.nav-item:active .nav-add-bg-left {
    left: -1px;
}

.nav-item:active .nav-add-bg-right {
    right: -1px;
}

/* ===== Progress Bar ===== */
.progress-bar {
    position: absolute;
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    z-index: var(--z-sticky);
}

.progress-fill {
    height: 100%;
    background: var(--text-primary);
    width: 0%;
    transition: width 0.1s linear;
}

/* ===== Double Tap Like Animation ===== */
.like-animation {
    position: absolute;
    pointer-events: none;
    z-index: var(--z-modal);
}

.like-animation svg {
    width: 100px;
    height: 100px;
    fill: var(--douyin-pink);
    filter: drop-shadow(0 0 16px rgba(254, 44, 85, 0.7));
    animation: likeFloat 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ===== Panels ===== */
.panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
    transition: transform var(--transition-slow);
    z-index: var(--z-modal);
}

.panel.show {
    transform: translateY(0);
}

.panel-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-primary);
    position: relative;
}

.panel-header h3 {
    color: var(--text-primary);
    font-size: var(--font-lg);
    font-weight: 600;
}

.panel-close {
    position: absolute;
    right: var(--spacing-lg);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.panel-close svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
}

/* Comment Panel */
.comment-panel {
    height: 65vh;
    display: flex;
    flex-direction: column;
}

.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-content {
    flex: 1;
}

.comment-user {
    font-size: var(--font-sm);
    color: var(--text-tertiary);
    margin-bottom: 4px;
    font-weight: 500;
}

.comment-text {
    font-size: var(--font-md);
    color: var(--text-primary);
    line-height: 1.4;
}

.comment-actions {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.comment-time {
    font-size: var(--font-sm);
    color: var(--text-disabled);
}

.comment-like {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-sm);
    color: var(--text-disabled);
    cursor: pointer;
}

.comment-like svg {
    width: 14px;
    height: 14px;
    fill: var(--text-disabled);
    transition: all var(--transition-fast);
}

.comment-like:hover svg,
.comment-like.liked svg {
    fill: var(--douyin-pink);
}

.comment-input-wrap {
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-primary);
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
}

.comment-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-full);
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: var(--font-base);
}

.comment-input::placeholder {
    color: var(--text-disabled);
}

.comment-input:focus {
    background: rgba(255, 255, 255, 0.15);
}

.comment-send {
    padding: 8px 18px;
    background: var(--douyin-pink);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: var(--font-base);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.comment-send:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-disabled);
    cursor: not-allowed;
}

.comment-send:not(:disabled):hover {
    background: #ff4d73;
}

/* Share Panel */
.share-panel {
    padding: var(--spacing-xl);
}

.share-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xl);
    padding-top: var(--spacing-md);
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.share-option:active {
    transform: scale(0.9);
}

.share-option .icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-option .icon svg {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
}

.share-option span {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* No Comments */
.no-comments {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-disabled);
}

.no-comments svg {
    width: 56px;
    height: 56px;
    fill: rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
}

.no-comments p {
    font-size: var(--font-base);
}

/* Hide on desktop */
@media (min-width: 1024px) {
    .mobile-only,
    .bottom-nav {
        display: none !important;
    }
    
    .friends-container,
    .messages-container,
    .upload-container,
    .page-container {
        padding-bottom: 20px;
    }
}
