:root {
    --bg-dark: #070204;
    --bg-header: linear-gradient(180deg, rgba(20, 4, 7, 0.97) 0%, rgba(14, 3, 5, 0.92) 100%);
    --bg-panel: rgba(18, 5, 8, 0.9);
    --bg-glass: rgba(26, 6, 10, 0.85);
    --border-color: rgba(255, 23, 68, 0.25);
    --border-highlight: rgba(255, 23, 68, 0.75);
    --accent-red: #ff1744;
    --accent-red-bright: #ff3d60;
    --accent-red-glow: rgba(255, 23, 68, 0.5);
    --accent-dark-red: #b71c1c;
    --accent-gold: #ff9100;
    --text-primary: #ffebee;
    --text-secondary: #fca5a5;
    --text-muted: #991b1b;
    --header-height: 60px;
    --font-heading: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Header & Navigation (Left-aligned tabs + Blood Red Theme)
   ========================================================================== */
.portal-header {
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 23, 68, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    z-index: 1000;
    position: relative;
}

.portal-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-red) 50%, transparent 100%);
    opacity: 0.6;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-corp-logo {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    border: 1px solid var(--border-highlight);
    box-shadow: 0 0 12px var(--accent-red-glow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.brand-logo:hover .brand-corp-logo {
    transform: scale(1.08) rotate(-2deg);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 10px var(--accent-red-glow);
}

.brand-title span {
    color: var(--accent-red);
}

.header-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn {
    padding: 7px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    outline: none;
    text-decoration: none;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 23, 68, 0.12);
    border-color: rgba(255, 23, 68, 0.35);
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.2);
}

.tab-btn.active {
    color: #fff;
    background: linear-gradient(180deg, rgba(255, 23, 68, 0.3) 0%, rgba(183, 28, 28, 0.15) 100%);
    border-color: var(--accent-red);
    box-shadow: 0 0 16px var(--accent-red-glow), inset 0 0 8px rgba(255, 23, 68, 0.2);
}

/* ==========================================================================
   Main Viewports
   ========================================================================== */
.portal-main {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: #050102;
}

.tab-content {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

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

.tab-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background-color: #0c0204;
}

.frame-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #080204;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.frame-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 23, 68, 0.15);
    border-top: 3px solid var(--accent-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 18px var(--accent-red-glow);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.frame-loading p {
    font-family: var(--font-heading);
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

/* ==========================================================================
   Embedded Mode
   ========================================================================== */
html.is-embedded .portal-header,
body.is-embedded .portal-header {
    display: none !important;
}

html.is-embedded .portal-main,
body.is-embedded .portal-main {
    height: 100vh !important;
    top: 0 !important;
}

/* ==========================================================================
   Média View (YouTube Feed with Blood Red Styling)
   ========================================================================== */
#view-media {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-red) rgba(10, 2, 4, 0.8);
}

#view-media::-webkit-scrollbar {
    width: 8px;
}
#view-media::-webkit-scrollbar-track {
    background: rgba(10, 2, 4, 0.8);
}
#view-media::-webkit-scrollbar-thumb {
    background-color: var(--accent-red);
    border-radius: 4px;
}

.media-backdrop {
    min-height: 100%;
    width: 100%;
    background: url('/background.png') no-repeat center center fixed;
    background-size: cover;
    position: relative;
    display: flex;
    justify-content: center;
    padding: 35px 20px 80px 20px;
}

.media-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(16, 2, 5, 0.6) 0%, rgba(8, 1, 3, 0.94) 100%),
                linear-gradient(180deg, rgba(18, 2, 5, 0.75) 0%, rgba(10, 1, 3, 0.5) 50%, rgba(6, 0, 2, 0.98) 100%);
    pointer-events: none;
    z-index: 1;
}

.media-content-container {
    position: relative;
    z-index: 2;
    max-width: 1360px;
    width: 100%;
}

.media-header-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
    padding: 24px 28px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
}

.media-header-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-red) 0%, #ff5252 50%, var(--accent-dark-red) 100%);
    box-shadow: 0 0 12px var(--accent-red);
}

.card-badge {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent-red);
    margin-bottom: 8px;
    text-transform: uppercase;
    text-shadow: 0 0 8px var(--accent-red-glow);
}

.media-page-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 0 20px var(--accent-red-glow);
}

.media-page-subtitle {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.media-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 23, 68, 0.15);
    border: 1px solid var(--border-highlight);
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.media-action-btn:hover {
    background: rgba(255, 23, 68, 0.35);
    box-shadow: 0 0 15px var(--accent-red-glow);
    transform: translateY(-2px);
}

.refresh-icon {
    display: inline-block;
    font-size: 16px;
    transition: transform 0.5s ease;
}

.media-action-btn.is-loading .refresh-icon {
    animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   Responsive Video Grid (Desktop 3 cols, Tablet 2 cols, Mobile 1 col)
   ========================================================================== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
    width: 100%;
}

@media (max-width: 1100px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 720px) {
    .video-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .media-header-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }
    .media-page-title {
        font-size: 22px;
    }
}

/* ==========================================================================
   Video Card
   ========================================================================== */
.video-card {
    background: rgba(20, 5, 9, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.video-card:hover {
    transform: translateY(-5px);
    border-color: var(--border-highlight);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85), 0 0 22px rgba(255, 23, 68, 0.35);
}

.video-thumb-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #0c0205;
    cursor: pointer;
}

.video-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.video-card:hover .video-thumb-img {
    transform: scale(1.05);
}

.video-duration-tag {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid rgba(255, 23, 68, 0.35);
    z-index: 2;
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 52px;
    height: 52px;
    background: rgba(255, 23, 68, 0.85);
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--accent-red-glow);
    transition: all 0.3s ease;
    opacity: 0.85;
    z-index: 2;
}

.video-play-btn::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 3px;
}

.video-thumb-container:hover .video-play-btn {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--accent-red);
    opacity: 1;
    box-shadow: 0 0 30px rgba(255, 23, 68, 0.8);
}

.video-card-body {
    padding: 18px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
}

.video-title {
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: color 0.2s ease;
}

.video-title:hover {
    color: var(--accent-red-bright);
}

.video-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.video-date {
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.85;
}

.video-unlisted-badge {
    font-family: var(--font-heading);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ff9100;
    background: rgba(255, 145, 0, 0.12);
    border: 1px solid rgba(255, 145, 0, 0.35);
    padding: 2px 7px;
    border-radius: 4px;
}

.video-description {
    font-size: 14px;
    color: #fca5a5;
    opacity: 0.75;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.video-card-footer {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    gap: 10px;
}

.video-watch-btn {
    width: 100%;
    padding: 9px 14px;
    background: linear-gradient(180deg, rgba(255, 23, 68, 0.25) 0%, rgba(183, 28, 28, 0.15) 100%);
    border: 1px solid var(--border-highlight);
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.video-watch-btn:hover {
    background: var(--accent-red);
    color: #fff;
    box-shadow: 0 0 16px var(--accent-red-glow);
    border-color: #fff;
}

.video-watch-btn.external {
    border-color: rgba(255, 145, 0, 0.5);
    background: rgba(255, 145, 0, 0.12);
    color: #ffb74d;
}
.video-watch-btn.external:hover {
    background: #ff9100;
    color: #000;
    box-shadow: 0 0 16px rgba(255, 145, 0, 0.6);
}

/* ==========================================================================
   Skeleton Loading State
   ========================================================================== */
.skeleton-card {
    background: rgba(18, 4, 7, 0.6);
    border: 1px solid rgba(255, 23, 68, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.skeleton-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(90deg, rgba(26, 6, 10, 0.6) 0%, rgba(45, 10, 18, 0.8) 50%, rgba(26, 6, 10, 0.6) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(26, 6, 10, 0.6) 0%, rgba(45, 10, 18, 0.8) 50%, rgba(26, 6, 10, 0.6) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}
.skeleton-line.title { height: 20px; width: 85%; }
.skeleton-line.date { height: 12px; width: 40%; }
.skeleton-line.desc { height: 14px; width: 100%; }
.skeleton-line.btn { height: 34px; width: 100%; margin-top: 10px; }

@keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================================================
   Empty & Error States
   ========================================================================== */
.video-state-card {
    grid-column: 1 / -1;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 50px 30px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.video-state-icon {
    font-size: 42px;
    margin-bottom: 4px;
}

.video-state-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.video-state-desc {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.5;
}

/* ==========================================================================
   Lightbox / Modal Player (Privacy-enhanced, lazy loaded)
   ========================================================================== */
.video-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-lightbox.active {
    display: flex;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 0, 1, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
}

.lightbox-modal {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 980px;
    background: #0d0205;
    border: 1px solid var(--accent-red);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 35px var(--accent-red-glow), 0 25px 60px rgba(0, 0, 0, 0.95);
    animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    0% { opacity: 0; transform: scale(0.92); }
    100% { opacity: 1; transform: scale(1); }
}

.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(180deg, rgba(25, 5, 10, 0.95) 0%, rgba(15, 2, 5, 0.95) 100%);
    border-bottom: 1px solid var(--border-color);
}

.lightbox-title {
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 15px;
}

.lightbox-close-btn {
    background: transparent;
    border: none;
    color: #ff6b81;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 4px;
}

.lightbox-close-btn:hover {
    color: #fff;
    transform: scale(1.15);
    text-shadow: 0 0 10px var(--accent-red);
}

.lightbox-player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
}

.lightbox-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}
