/* ===== Premium PBR Phone Component ===== */
/* A realistic, physically-based rendered phone with metallic materials */

/* Phone Container */
.pbr-phone-container {
    position: relative;
    perspective: 1500px;
    transform-style: preserve-3d;
}

.pbr-phone {
    position: relative;
    width: 300px;
    height: 620px;
    transform-style: preserve-3d;
    /* Explicit default transform to prevent sub-pixel jitter */
    transform: rotateY(0deg) rotateX(0deg) translateZ(0px);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.pbr-phone:hover {
    transform: rotateY(-8deg) rotateX(5deg) translateZ(20px);
}

/* Phone Body - Titanium Frame with PBR Materials */
.pbr-phone-body {
    position: absolute;
    inset: 0;
    border-radius: 52px;
    transform-style: preserve-3d;
    
    /* Multi-layer metallic gradient for titanium look */
    background: 
        /* Top highlight - specular reflection */
        linear-gradient(
            165deg,
            rgba(255, 255, 255, 0.35) 0%,
            rgba(255, 255, 255, 0.08) 15%,
            transparent 40%
        ),
        /* Side metallic gradient */
        linear-gradient(
            90deg,
            #1a1a2e 0%,
            #2d2d44 8%,
            #454563 15%,
            #3a3a55 35%,
            #2a2a40 50%,
            #353550 65%,
            #454563 85%,
            #2d2d44 92%,
            #1a1a2e 100%
        ),
        /* Base titanium color */
        linear-gradient(
            180deg,
            #2c2c42 0%,
            #252538 50%,
            #1e1e30 100%
        );
    
    /* Realistic shadows and depth */
    box-shadow:
        /* Inner edge highlight */
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        inset 0 -1px 1px rgba(0, 0, 0, 0.3),
        inset 1px 0 1px rgba(255, 255, 255, 0.08),
        inset -1px 0 1px rgba(0, 0, 0, 0.2),
        /* Outer shadow layers */
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 12px 24px rgba(0, 0, 0, 0.4),
        0 24px 48px rgba(0, 0, 0, 0.3),
        /* Ambient occlusion */
        0 2px 4px rgba(0, 0, 0, 0.5),
        /* Colored ambient light */
        0 0 80px rgba(139, 92, 246, 0.15),
        0 0 120px rgba(6, 182, 212, 0.1);
}

/* Frame edges - 3D depth effect */
.pbr-phone-body::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 54px;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.03) 30%,
        rgba(0, 0, 0, 0.2) 70%,
        rgba(0, 0, 0, 0.3) 100%
    );
    z-index: -1;
}

/* Additional frame chamfer effect */
.pbr-phone-body::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

/* Phone Screen Container */
.pbr-phone-screen-container {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border-radius: 46px;
    overflow: hidden;
    background: #000;
    /* Prevent sub-pixel jitter during parent transform */
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    
    /* Screen bezel shadow */
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.8),
        inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Glass Screen Effect */
.pbr-phone-screen {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0a0a14 0%, #12121f 50%, #0d0d18 100%);
    border-radius: 46px;
    overflow: hidden;
}

/* Screen Glass Reflection Overlay */
.pbr-phone-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        125deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.02) 30%,
        transparent 50%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 100;
}

/* Subtle screen edge highlight */
.pbr-phone-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 46px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
    z-index: 101;
}

/* Dynamic Island / Notch */
.pbr-phone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 34px;
    background: #000;
    border-radius: 20px;
    z-index: 50;
    
    /* Notch depth */
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.5),
        0 1px 1px rgba(255, 255, 255, 0.05);
}

/* Camera and sensors in notch */
.pbr-phone-notch::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: radial-gradient(
        circle,
        #1a1a2e 30%,
        #0d0d15 50%,
        #252538 70%
    );
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pbr-phone-notch::after {
    content: '';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #2d1f4e 0%, #1a1a2e 100%);
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Screen Content Area */
.pbr-phone-content {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    overflow: hidden;
}

/* Side Buttons - Volume and Power */
.pbr-phone-button {
    position: absolute;
    background: linear-gradient(
        90deg,
        #252538 0%,
        #3a3a55 50%,
        #252538 100%
    );
    border-radius: 2px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3),
        0 0 4px rgba(0, 0, 0, 0.5);
}

.pbr-phone-button--power {
    right: -4px;
    top: 140px;
    width: 4px;
    height: 80px;
}

.pbr-phone-button--volume-up {
    left: -4px;
    top: 100px;
    width: 4px;
    height: 45px;
}

.pbr-phone-button--volume-down {
    left: -4px;
    top: 155px;
    width: 4px;
    height: 45px;
}

.pbr-phone-button--silent {
    left: -4px;
    top: 70px;
    width: 4px;
    height: 20px;
}

/* Ambient Glow Effect */
.pbr-phone-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: -1;
    
    background: radial-gradient(
        ellipse at center,
        rgba(139, 92, 246, 0.25) 0%,
        rgba(6, 182, 212, 0.15) 30%,
        transparent 60%
    );
    
    filter: blur(40px);
    animation: glow-pulse 4s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Reflection Layer - Simulates environment reflection */
.pbr-phone-reflection {
    position: absolute;
    inset: 0;
    border-radius: 52px;
    pointer-events: none;
    z-index: 10;
    
    background: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.04) 25%,
        transparent 45%,
        transparent 55%,
        rgba(255, 255, 255, 0.02) 75%,
        rgba(255, 255, 255, 0.06) 100%
    );
    
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.pbr-phone:hover .pbr-phone-reflection {
    opacity: 1;
}

/* ===== Screen Content Styles ===== */

/* App Interface Header */
.pbr-app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pbr-app-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.pbr-app-status-bar .time {
    font-weight: 600;
}

.pbr-app-status-bar .icons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Location Badge */
.pbr-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 8px 14px;
    border-radius: 50px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.pbr-location-badge .icon {
    font-size: 14px;
}

/* Featured Card */
.pbr-featured-card {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.03) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.pbr-featured-card .card-image {
    height: 120px;
    background: linear-gradient(
        135deg,
        #667eea 0%,
        #764ba2 50%,
        #8B5CF6 100%
    );
    position: relative;
}

.pbr-featured-card .card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.5) 100%);
}

.pbr-featured-card .card-body {
    padding: 16px;
}

.pbr-featured-card .card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
}

.pbr-featured-card .card-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;
}

/* Audio Player Bar */
.pbr-audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(
        90deg,
        rgba(139, 92, 246, 0.2) 0%,
        rgba(6, 182, 212, 0.2) 100%
    );
    padding: 12px 16px;
    border-radius: 12px;
}

.pbr-audio-play-btn {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary, linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
}

.pbr-audio-waves {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.pbr-audio-waves span {
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #8B5CF6 0%, #06B6D4 100%);
    border-radius: 2px;
    animation: pbr-wave 1s ease-in-out infinite;
    transform-origin: bottom;
}

.pbr-audio-waves span:nth-child(1) { animation-delay: 0s; height: 40%; }
.pbr-audio-waves span:nth-child(2) { animation-delay: 0.1s; height: 70%; }
.pbr-audio-waves span:nth-child(3) { animation-delay: 0.2s; height: 50%; }
.pbr-audio-waves span:nth-child(4) { animation-delay: 0.3s; height: 90%; }
.pbr-audio-waves span:nth-child(5) { animation-delay: 0.4s; height: 60%; }
.pbr-audio-waves span:nth-child(6) { animation-delay: 0.5s; height: 80%; }
.pbr-audio-waves span:nth-child(7) { animation-delay: 0.6s; height: 45%; }
.pbr-audio-waves span:nth-child(8) { animation-delay: 0.7s; height: 65%; }
.pbr-audio-waves span:nth-child(9) { animation-delay: 0.8s; height: 55%; }
.pbr-audio-waves span:nth-child(10) { animation-delay: 0.9s; height: 75%; }

@keyframes pbr-wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* Home Screen Variant */
.pbr-home-content {
    text-align: center;
    padding-top: 30px;
}

.pbr-greeting {
    margin-bottom: 30px;
}

.pbr-greeting .emoji {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    animation: wave-hand 2s ease-in-out infinite;
}

@keyframes wave-hand {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

.pbr-greeting h3 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.pbr-greeting p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* Discovery Card */
.pbr-discovery-card {
    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, 0.15) 0%,
        rgba(6, 182, 212, 0.15) 100%
    );
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 20px;
    padding: 20px;
    text-align: left;
}

.pbr-discovery-card .header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.pbr-discovery-card .header .icon {
    font-size: 16px;
}

.pbr-listen-btn {
    width: 100%;
    background: var(--gradient-primary, linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%));
    border: none;
    border-radius: 12px;
    padding: 14px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pbr-listen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

/* Floating Cards - Enhanced */
.pbr-floating-cards {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}

.pbr-phone:hover ~ .pbr-floating-cards {
    transform: translateZ(-60px);
}

.pbr-float-card {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: rgba(18, 18, 26, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(139, 92, 246, 0.1);
    animation: pbr-float 4s ease-in-out infinite;
}

.pbr-float-card .icon {
    font-size: 18px;
}

.pbr-float-card--1 {
    top: 15%;
    left: -100px;
    animation-delay: 0s;
}

.pbr-float-card--2 {
    top: 45%;
    right: -90px;
    animation-delay: 1s;
}

.pbr-float-card--3 {
    bottom: 20%;
    left: -80px;
    animation-delay: 2s;
}

@keyframes pbr-float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-8px) translateX(5px);
    }
    50% {
        transform: translateY(-15px) translateX(-3px);
    }
    75% {
        transform: translateY(-8px) translateX(8px);
    }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .pbr-phone {
        width: 260px;
        height: 540px;
    }
    
    .pbr-phone-body {
        border-radius: 44px;
    }
    
    .pbr-phone-screen-container {
        border-radius: 40px;
    }
    
    .pbr-phone-screen {
        border-radius: 40px;
    }
    
    .pbr-phone-notch {
        width: 100px;
        height: 28px;
    }
    
    .pbr-phone-content {
        top: 48px;
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .pbr-phone-container {
        transform: scale(0.85);
    }
    
    .pbr-float-card--1 {
        left: -60px;
    }
    
    .pbr-float-card--2 {
        right: -50px;
    }
    
    .pbr-float-card--3 {
        left: -50px;
    }
}

@media (max-width: 480px) {
    .pbr-phone-container {
        transform: scale(0.75);
    }
}
