/**
 * Mobile Player Styles - UNIFIED VERSION
 * Works for: Standalone Player (/Mobile/) AND Catalog App (/App/)
 * 
 * Location: mydigital.media/css/mobile-player.css
 * 
 * v2: Added 3-panel system (catalog → detail → player)
 */

/* ========================================
   GLOBAL STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #000000;
    /*font-family: 'Varela', Arial, sans-serif;*/
    font-family: 'Ubuntu', Arial, sans-serif;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

html {
    scroll-behavior: smooth;
}

/* ========================================
   APP VIEWPORT (Catalog App Mode Only)
   Contains catalog, detail, and player panels
   ======================================== */
.app-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* When app-viewport exists, allow minimal scroll for browser chrome hide */
body:has(.app-viewport) {
    overflow-y: scroll;
    height: calc(100% + 1px);
}

html:has(.app-viewport) {
    overflow-y: scroll;
    height: calc(100% + 1px);
}

/* ========================================
   PANEL BASE STYLES (App Mode)
   Three panels: catalog, detail, player
   ======================================== */
.catalog-panel,
.detail-panel,
.player-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: calc(100dvh + 1px); /* Enables browser chrome auto-hide on scroll */
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #000000;
}

/* Catalog Panel - Starts visible */
.catalog-panel {
    transform: translateX(0);
    z-index: 1;
}

/* Detail Panel - Starts off-screen right */
.detail-panel {
    transform: translateX(100%);
    z-index: 2;
}

/* Player Panel - Starts off-screen right */
.player-panel {
    transform: translateX(100%);
    z-index: 3;
}

/* ========================================
   SLIDE STATES
   ======================================== */

/* STATE: Detail Active (artist selected from catalog) */
.app-viewport.detail-active .catalog-panel {
    transform: translateX(-30%);
    pointer-events: none;
}

.app-viewport.detail-active .detail-panel {
    transform: translateX(0);
}

/* STATE: Player Active (playlist selected from detail) */
.app-viewport.player-active .catalog-panel {
    transform: translateX(-30%);
    pointer-events: none;
}

.app-viewport.player-active .detail-panel {
    transform: translateX(-30%);
    pointer-events: none;
}

.app-viewport.player-active .player-panel {
    transform: translateX(0);
}

/* ========================================
   CATALOG HEADER (App Mode)
   ======================================== */
.catalog-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #000000;
    padding: 10px 0 0 0;
}

.catalog-header .header-clickable-wrapper {
    position: relative;
    width: 90%;
    max-width: 400px;
    margin: 0 auto;
}

.catalog-header .header-image {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}

.catalog-header .header-zone {
    position: absolute;
    top: 0;
    height: 100%;
    cursor: pointer;
    z-index: 10;
}

.catalog-header .header-zone-left {
    left: 0;
    width: 50%;
}

.catalog-header .header-zone-right {
    right: 0;
    width: 50%;
}

/* 25/50/25 split zones */
.catalog-header .header-zone-quarter-left {
    left: 0;
    width: 25%;
}

.catalog-header .header-zone-half-center {
    left: 25%;
    width: 50%;
}

.catalog-header .header-zone-quarter-right {
    right: 0;
    width: 25%;
}

/* ========================================
   CATALOG LICENSE LINK (App Mode)
   ======================================== */
.catalog-license-link {
    text-align: center;
    padding: 15px 10px;
}

.catalog-license-link a {
    color: #cccccc;
    text-decoration: underline;
    font-size: 13px;
}

/* ========================================
   ARTIST GRID (App Mode)
   ======================================== */
.artist-grid {
    display: grid;
    grid-template-columns: repeat(2, 180px);
    gap: 10px;
    padding: 25px 20px 0px 20px;
    justify-content: center;
    margin: 0 auto;
}

.artist-tile {
    width: 180px;
    height: 180px;
    border-radius: 0;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    background: #000000;
}

.artist-tile:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.artist-tile.empty {
    background: transparent;
    cursor: default;
}

.artist-tile.empty:active {
    transform: none;
    opacity: 1;
}

.artist-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========================================
   CATALOG FOOTER (App Mode)
   ======================================== */
.catalog-footer {
    text-align: center;
    padding: 10px;
    color: #666666;
    font-size: 12px;
    line-height: 1.6;
}

.catalog-footer a {
    color: #999999;
    text-decoration: none;
}

.catalog-footer p {
    margin: 10px 0;
}

/* ========================================
   DETAIL PANEL LAYOUT (Flexbox for footer positioning)
   ======================================== */
.detail-panel {
    display: flex;
    flex-direction: column;
}

.detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ========================================
   ARTIST HERO SECTION (Detail Panel)
   Sticky - stays in place while playlists scroll
   ======================================== */
.artist-hero {
    position: sticky;
    top: 70px; /* Below header */
    z-index: 50;
    background: #000000;
    padding: 0;
}

.artist-hero-image {
    width: auto;
    height: auto;
    margin: 0 auto;
    overflow: hidden;
    background: #1a1a1a;
}

.artist-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.artist-hero-info {
    padding: 15px 20px;
    text-align: left;
}

.artist-name {
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    margin: 0 0 10px 0;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.artist-bio {
    font-size: 14px;
    color: #999999;
    line-height: 1.5;
    margin: 0;
    font-family: 'Ubuntu', Arial, sans-serif;
}

/* ========================================
   PLAYLIST SELECTION (Detail Panel)
   Text-based playlist rows with thumbnail
   ======================================== */
.playlist-selection {
    flex: 1;
    padding: 10px 0;
}

.playlist-row {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    border-bottom: 1px solid #1a1a1a;
}

.playlist-row:active {
    background: #1a1a1a;
    opacity: 0.8;
}

.playlist-row:last-child {
    border-bottom: none;
}

.playlist-row-thumbnail {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playlist-row-thumbnail img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.playlist-row-text {
    flex: 1;
    min-width: 0;
}

.playlist-row-title {
    /*font-size: 14px;*/
    font-size: 22px;
    font-weight: bold;
    color: white;
    margin-bottom: 4px;
    font-family: 'Ubuntu', Arial, sans-serif;
}

.playlist-row-description {
    /*font-size: 16px;*/
    font-size: 19px;
    color: #ffffff;
    font-family: 'Ubuntu', Arial, sans-serif;
}

/* Detail footer - stays at bottom */
.detail-footer {
    margin-top: auto;
    text-align: center;
    padding: 20px;
    color: #666666;
    font-size: 12px;
    line-height: 1.6;
    background: #000000;
}

.detail-footer a {
    color: #999999;
    text-decoration: none;
}

.detail-footer p {
    margin: 10px 0;
}

/* ========================================
   STICKY HEADER (Standalone Player Mode)
   ======================================== */
.mobile-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #000000;
    width: 100%;
    transition: all 0.3s ease;
	margin-bottom: 0;
}

/* Wrapper for image + clickable zones (Standalone) */
.header-clickable-wrapper {
    position: relative;
    width: 90%;
    height: 90px;
    margin: 0 auto;
}

.header-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
}

/* Clickable zones */
.header-zone {
    position: absolute;
    top: 0;
    height: 100%;
    cursor: pointer;
    z-index: 10;
}

.header-zone-left {
    left: 0;
    width: 50%;
}

.header-zone-right {
    right: 0;
    width: 50%;
}

/* 1/3 left zone for back button */
.header-zone-back {
    left: 0;
    width: 33.33%;
    cursor: pointer;
}

/* 2/3 right zone */
.header-zone-right-wide {
    right: 0;
    width: 66.67%;
}

/* ========================================
   PLAYER HEADER WITH BACK BUTTON (App Mode)
   ======================================== */
.header-content {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    gap: 15px;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    color: #7c1749;
    font-family: 'Ubuntu', Arial, sans-serif;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 20px;
    transition: background 0.2s;
}

.back-button:active {
    background: rgba(124, 23, 73, 0.2);
}

.back-arrow {
    font-size: 20px;
    font-weight: bold;
}

.back-text {
    font-weight: bold;
}

.header-artist-name {
    flex: 1;
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-artist-logo {
    flex: 1;
    height: 40px;
    max-width: 200px;
    object-fit: contain;
    object-position: right center;
}

/* ========================================
   LANDSCAPE WARNING OVERLAY
   ======================================== */
.landscape-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    padding: 20px;
}

.landscape-warning.active {
    display: flex;
}

.landscape-warning-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: rotate-phone 2s infinite;
}

@keyframes rotate-phone {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.landscape-warning-text {
    font-size: 24px;
    color: #fff;
    font-family: 'Ubuntu', Arial, sans-serif;
}

/* CSS-only landscape detection for phones */
@media (orientation: landscape) and (max-height: 500px) {
    .landscape-warning {
        display: flex;
    }
}
/* ========================================
   PLAYER SECTION (Always Visible)
   ======================================== */
.player-section {
    background: #000000;
    padding: 0px 20px 0px 20px;
    position: sticky;
    top: 70px;  /* MadDog default */
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* App mode player section - MadDog Catalog */
.player-panel .player-section {
    top: 90px;  /* MadDog catalog header height */
}

/* ========================================
   SITE-SPECIFIC OVERRIDES
   Add class="site-hamsterbrain" to body tag
   ======================================== */
/* HamsterBrain has taller header with navigation */
body.site-hamsterbrain .player-section {
    top: 90px;
}

body.site-hamsterbrain .player-panel .player-section {
    top: 105px;
}

/* ========================================
   HERO ALBUM ART
   ======================================== */
.hero-card {
    position: relative;
    width: 100%;
    max-width: 330px;
    /*margin: 0 auto 20px auto;*/
    margin: 0 auto 10px auto;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 10;
    background: #1a1a1a;
}

.hero-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 1.0s ease-in-out;
}

/* Hero Overlay */
.hero-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.15;
    transition: opacity 0.3s ease;
}

.hero-overlay.paused {
    opacity: 0.8;
}

.hero-overlay:active {
    opacity: 1.0;
}

.hero-overlay img {
    width: 100%;
    height: 100%;
}

/* ========================================
   SONG INFO (Static - if marquee disabled)
   ======================================== */
.song-info {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
}

.song-title {
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 5px;
}

.song-artist {
    font-size: 16px;
    color: #cccccc;
}

/* ========================================
   SONG INFO MARQUEE
   ======================================== */
.song-info-marquee {
    width: 100%;
    max-width: 350px;
    margin: 0 auto 5px auto;
    overflow: hidden;
    white-space: nowrap;
    background: #000;
    height: 30px;
    display: flex;
    align-items: center;
}

.marquee-track {
    display: flex;
    width: max-content;
    will-change: transform;
}

.marquee-text {
    font-family: 'Ubuntu', Arial, sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    padding-right: 100px;
    white-space: nowrap;
}

.marquee-artist,
.marquee-track-info,
.marquee-playlist {
    display: inline-block;
    white-space: nowrap;
}

.marquee-artist {
    margin-right: 50px;
}

.marquee-track-info {
    margin-right: 50px;
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.hero-loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 15;
}

.hero-loading-spinner.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   PLAYER CONTROLS
   ======================================== */
.player-controls {
    width: 100%;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 5px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.time-display {
    font-size: 12px;
    color: #ffffff;
    min-width: 35px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: #7c1749;
    width: 0%;
    transition: width 0.2s linear;
    border-radius: 3px;
}

.action-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.btn-action {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.7;
    padding: 0;
}

.btn-action:active {
    transform: scale(0.95);
    opacity: 1;
}

.btn-action img {
    width: 100%;
    height: 100%;
}

.action-label {
    font-size: 9px;
    color: #cccccc;
    font-weight: bold;
    letter-spacing: 0.5px;
    opacity: 0.7;
    margin-top: 8px;
}

/* ========================================
   PLAYLIST SECTION (Scrollable)
   ======================================== */
.playlist-section {
    background: #0a0a0a;
    padding: 0px 0;
    flex: 1;
    min-height: 200px;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    /*padding: 12px 15px;*/
    padding: 8px 15px;
    border-bottom: 1px solid #1a1a1a;
    transition: background 0.2s;
}

.playlist-item:active {
    background: #1a1a1a;
}

.playlist-item.active {
    background: #1a1a1a;
}

.playlist-thumbnail {
    width: 60px;
    height: 60px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}

.playlist-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.playlist-text {
    flex: 1;
    min-width: 0;
}

.playlist-song-title {
    font-size: 15px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-song-artist {
    font-size: 13px;
    color: #999999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item.active .playlist-song-title {
    color: #ffffff;
    font-weight: bold;
}

/* ========================================
   FOOTER
   ======================================== */
.footer-text {
    background: #000000;
    padding: 20px;
    text-align: center;
    color: #666666;
    font-size: 12px;
    line-height: 1.6;
}

.footer-text a {
    color: #999999;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-text a:active {
    color: #bfbfbf;
}

.footer-text p {
    margin: 0px 0;
}

/* ========================================
   LOADING STATE
   ======================================== */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
    font-size: 16px;
}

/* ========================================
   ERROR MESSAGE
   ======================================== */
.error-message {
    color: #d32f2f;
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
}

/* ========================================
   HAMSTER CAMEO
   ======================================== */
.hamster-cameo {
    position: fixed;
    bottom: 0;
    right: -22px;
    width: 160px;
    height: 160px;
    z-index: 100000000;
    pointer-events: none;
}

.hamster-cameo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ========================================
   PWA INSTALL BANNER
   ======================================== */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-top: 2px solid #7c1749;
    padding: 15px 20px;
    z-index: 999999999;
    display: none;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.pwa-install-banner.show {
    display: block;
}

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

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.pwa-banner-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    flex-shrink: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.pwa-banner-icon img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
}

.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-title {
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 3px;
}

.pwa-banner-subtitle {
    font-size: 12px;
    color: #aaaaaa;
    line-height: 1.3;
}

.pwa-banner-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-btn-install {
    background: linear-gradient(135deg, #7c1749 0%, #a02060 100%);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.pwa-btn-install:active {
    transform: scale(0.95);
}

.pwa-btn-dismiss {
    background: #333333;
    color: #cccccc;
    border: 1px solid #555555;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 15px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.pwa-btn-dismiss:active {
    background: #444444;
    color: #ffffff;
}

.pwa-dont-ask {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #333333;
}

.pwa-dont-ask input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #7c1749;
}

.pwa-dont-ask label {
    color: #999999;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

/* Footer install link (shows if permanently dismissed) */
.pwa-footer-install {
    display: none;
    margin-top: 10px;
}

.pwa-footer-install.show {
    display: block;
}

.pwa-footer-install a {
    color: #7c1749;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
}

.pwa-footer-install a:active {
    color: #a02060;
}

/* iOS-specific instructions popup */
.pwa-ios-instructions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-top: 2px solid #7c1749;
    padding: 20px;
    z-index: 999999999;
    display: none;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.pwa-ios-instructions.show {
    display: block;
}

.pwa-ios-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 15px;
}

.pwa-ios-steps {
    color: #cccccc;
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 15px;
}

.pwa-ios-steps .step-icon {
    font-size: 20px;
    vertical-align: middle;
}

.pwa-ios-close {
    background: #333;
    color: #ffffff;
    border: none;
    padding: 10px 30px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

/* ========================================
   TOUCH IMPROVEMENTS
   ======================================== */
.btn-action,
.hero-overlay,
.artist-tile,
.back-button,
.playlist-row {
    -webkit-user-select: none;
    user-select: none;
}

