/**
 * ===================================
 * YOUTUBE SHORTS - PROFESSIONAL DESIGN
 * ===================================
 */

/* ===================================
   CSS VARIABLES
   =================================== */
:root {
    --shorts-bg: #000;
    --shorts-text: #fff;
    --shorts-text-secondary: rgba(255, 255, 255, 0.7);
    --shorts-overlay-gradient: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 40%, transparent 100%);
    --shorts-overlay-top: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    --shorts-red: #ff0000;
    --shorts-transition: 0.2s cubic-bezier(0.05, 0, 0, 1);
    --shorts-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ===================================
   RESET & BASE
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.yp-shorts-page {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: var(--shorts-bg);
    font-family: "Roboto", "Arial", sans-serif;
    color: var(--shorts-text);
    line-height: 1;
}

.yp-shorts-page #wpadminbar {
    display: none !important;
}

/* ===================================
   MAIN WRAPPER
   =================================== */
.yp-shorts-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--shorts-bg);
    transform: translateZ(0);
}

.yp-shorts-wrapper::-webkit-scrollbar {
    display: none;
}

/* ===================================
   SHORT ITEM
   =================================== */
.yp-short {
    position: relative;
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: var(--shorts-bg);
    overflow: hidden;
}

/* ===================================
   VIDEO CONTAINER
   =================================== */
.yp-short-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--shorts-bg);
}

.yp-short-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* External Video */
.yp-short-external {
    position: relative;
    width: 100%;
    height: 100%;
}

.yp-external-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.yp-external-play-btn {
    width: 72px;
    height: 72px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding-left: 4px;
}

.yp-external-play-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.05);
}

.yp-external-play-btn:active {
    transform: scale(0.95);
}

.yp-platform-badge {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    backdrop-filter: blur(10px);
}

.yp-external-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.yp-external-iframe iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* Tap Zone */
.yp-tap-zone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

/* Progress Bar */
.yp-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 10;
}

.yp-progress-bar {
    height: 100%;
    width: 0;
    background: var(--shorts-red);
    transition: width 0.1s linear;
}

/* Volume Indicator */
.yp-volume-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 16px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

.yp-volume-indicator.show {
    opacity: 1;
}

/* ===================================
   OVERLAY STRUCTURE
   =================================== */
.yp-short-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    z-index: 20;
}

.yp-short-overlay > * {
    pointer-events: auto;
}

/* ===================================
   TOP BAR - YOUTUBE STYLE
   =================================== */
.yp-short-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    background: var(--shorts-overlay-top);
}

.yp-btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    color: var(--shorts-text);
    transition: background var(--shorts-transition);
}

.yp-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.yp-btn-icon:active {
    background: rgba(255, 255, 255, 0.2);
}

/* ===================================
   BOTTOM INFO - YOUTUBE STYLE
   =================================== */
.yp-short-bottom {
    display: flex;
    gap: 12px;
    padding: 0 12px 90px 16px;
    background: var(--shorts-overlay-gradient);
    align-items: flex-end;
}

.yp-short-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Channel Row */
.yp-channel-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.yp-channel-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.yp-channel-name {
    color: var(--shorts-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.yp-subscribe-btn {
    padding: 0 12px;
    height: 32px;
    background: var(--shorts-text);
    color: var(--shorts-bg);
    border: none;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity var(--shorts-transition);
}

.yp-subscribe-btn:active {
    opacity: 0.8;
}

.yp-subscribe-btn.subscribed {
    background: rgba(255, 255, 255, 0.15);
    color: var(--shorts-text);
}

/* Video Title */
.yp-video-title {
    color: var(--shorts-text);
    font-size: 14px;
    font-weight: 400;
    line-height: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Video Description */
.yp-video-desc {
    color: var(--shorts-text-secondary);
    font-size: 12px;
    line-height: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Audio Tag */
.yp-audio-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    color: var(--shorts-text);
    font-size: 11px;
    align-self: flex-start;
}

/* ===================================
   RIGHT ACTIONS - YOUTUBE STYLE
   =================================== */
.yp-short-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    padding-bottom: 8px;
}

.yp-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.yp-action-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform var(--shorts-transition);
    padding: 0;
}

.yp-action-btn:active {
    transform: scale(0.85);
}

.yp-action-btn.active svg {
    filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.5));
}

.yp-action-count {
    color: var(--shorts-text);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1;
}

.yp-action-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--shorts-text);
    object-fit: cover;
}

/* ===================================
   BOTTOM NAVIGATION - YOUTUBE STYLE
   =================================== */
.yp-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--shorts-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    z-index: 100;
}

.yp-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--shorts-text-secondary);
    text-decoration: none;
    font-size: 10px;
    font-weight: 400;
    transition: color var(--shorts-transition);
    padding: 6px 0;
}

.yp-nav-item.active {
    color: var(--shorts-text);
}

.yp-nav-item svg {
    width: 24px;
    height: 24px;
}

.yp-nav-add svg {
    width: 28px;
    height: 28px;
}

/* ===================================
   EMPTY STATE
   =================================== */
.yp-shorts-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    padding: 40px 20px;
}

.yp-shorts-empty h3 {
    font-size: 18px;
    font-weight: 400;
    margin: 16px 0 8px;
}

.yp-shorts-empty p {
    font-size: 14px;
    color: var(--shorts-text-secondary);
    margin-bottom: 24px;
}

.yp-home-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--shorts-text);
    color: var(--shorts-bg);
    border-radius: 18px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: opacity var(--shorts-transition);
}

.yp-home-btn:active {
    opacity: 0.8;
}

/* ===================================
   COMMENTS MODAL - YOUTUBE STYLE
   =================================== */
.yp-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: flex-end;
}

.yp-modal.active {
    display: flex;
}

.yp-modal-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.yp-modal-content {
    position: relative;
    width: 100%;
    max-height: 75vh;
    background: #212121;
    border-radius: 12px 12px 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.yp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.yp-modal-header h3 {
    font-size: 14px;
    font-weight: 400;
    color: var(--shorts-text-secondary);
}

.yp-modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--shorts-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--shorts-transition);
}

.yp-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.yp-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.yp-comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.yp-comment-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.yp-comment-content {
    flex: 1;
    min-width: 0;
}

.yp-comment-author {
    color: var(--shorts-text);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
}

.yp-comment-text {
    color: var(--shorts-text-secondary);
    font-size: 13px;
    line-height: 18px;
    word-wrap: break-word;
}

.yp-comments-loading,
.yp-comments-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--shorts-text-secondary);
    font-size: 14px;
}

/* ===================================
   TOAST NOTIFICATION
   =================================== */
.yp-toast {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 13px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.yp-toast.show {
    opacity: 1;
}

/* ===================================
   LOADING SPINNER
   =================================== */
.yp-external-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.yp-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--shorts-text);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ===================================
   ACCESSIBILITY
   =================================== */
.yp-action-btn:focus,
.yp-subscribe-btn:focus,
.yp-external-play-btn:focus,
.yp-btn-icon:focus,
.yp-nav-item:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ===================================
   DESKTOP LAYOUT
   =================================== */
@media (min-width: 768px) {
    .yp-shorts-wrapper,
    .yp-bottom-nav,
    .yp-modal-content {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .yp-bottom-nav {
        left: 50%;
        transform: translateX(-50%);
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }
}

/* ===================================
   LANDSCAPE MODE
   =================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .yp-short-bottom {
        padding-bottom: 20px;
    }
    
    .yp-short-actions {
        gap: 8px;
    }
    
    .yp-bottom-nav {
        display: none;
    }
}

/* ===================================
   SAFE AREA (NOTCH)
   =================================== */
@supports (padding: max(0px)) {
    .yp-short-top {
        padding-top: max(8px, env(safe-area-inset-top));
    }
    
    .yp-short-bottom {
        padding-bottom: max(90px, calc(90px + env(safe-area-inset-bottom)));
    }
    
    .yp-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(48px + env(safe-area-inset-bottom));
    }
}

/* ===================================
   PERFORMANCE
   =================================== */
.yp-short {
    will-change: transform;
    contain: layout style paint;
}

.yp-short-video {
    will-change: transform;
}

/* ===================================
   REDUCED MOTION
   =================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}