/* ========================================
   iPhone 16 Pro Max Mockup Styles
   ======================================== */

/* iPhone Frame Dimensions (scaled) */
:root {
    /* iPhone 16 Pro Max: 1290 x 2796 pixels, 6.9" screen */
    /* Scale factor for preview: ~0.27 for desktop */
    --iphone-width: 350px;
    --iphone-height: 756px;
    --iphone-bezel: 12px;
    --iphone-radius: 55px;
    --iphone-notch-width: 126px;
    --iphone-notch-height: 36px;
    --iphone-notch-radius: 20px;

    /* Dynamic Island dimensions */
    --dynamic-island-width: 126px;
    --dynamic-island-height: 36px;

    /* Screen inner dimensions */
    --screen-width: calc(var(--iphone-width) - var(--iphone-bezel) * 2);
    --screen-height: calc(var(--iphone-height) - var(--iphone-bezel) * 2);

    /* News tile dimensions (medium widget size) */
    --tile-width: 170px;
    --tile-height: 170px;
    --tile-radius: 24px;
}

/* iPhone Container */
.iphone-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: var(--space-lg);
}

/* iPhone Frame */
.iphone-frame {
    position: relative;
    width: var(--iphone-width);
    height: var(--iphone-height);
    background: #1a1a1a;
    border-radius: var(--iphone-radius);
    box-shadow:
        0 0 0 2px #2a2a2a,
        0 0 0 4px #1a1a1a,
        var(--shadow-xl);
    overflow: hidden;
}

/* Side Buttons */
.iphone-frame::before {
    content: '';
    position: absolute;
    right: -3px;
    top: 180px;
    width: 3px;
    height: 100px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a, #2a2a2a);
    border-radius: 2px 0 0 2px;
}

.iphone-frame::after {
    content: '';
    position: absolute;
    left: -3px;
    top: 140px;
    width: 3px;
    height: 36px;
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a, #2a2a2a);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 60px 0 #1a1a1a;
}

/* iPhone Screen */
.iphone-screen {
    position: absolute;
    top: var(--iphone-bezel);
    left: var(--iphone-bezel);
    right: var(--iphone-bezel);
    bottom: var(--iphone-bezel);
    background: #000;
    border-radius: calc(var(--iphone-radius) - 8px);
    overflow: hidden;
}

/* Wallpaper */
.iphone-wallpaper {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg,
            rgba(0, 0, 0, 0.3) 0%,
            rgba(0, 0, 0, 0.1) 30%,
            rgba(0, 0, 0, 0.2) 100%),
        linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-size: cover;
    background-position: center;
}

/* Dynamic Island */
.dynamic-island {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: var(--dynamic-island-width);
    height: var(--dynamic-island-height);
    background: #000;
    border-radius: var(--iphone-notch-radius);
    z-index: 100;
}

/* Status Bar */
.status-bar {
    position: absolute;
    top: 16px;
    left: 20px;
    right: 20px;
    height: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
}

.status-time {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.3px;
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-icons svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Home Screen Layout */
.home-screen {
    position: absolute;
    inset: 0;
    padding: 60px 20px 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* App Grid */
.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 12px;
    margin-top: 16px;
}

/* Placeholder App Icon */
.app-icon-placeholder {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    backdrop-filter: blur(10px);
}

/* News Widget Tile */
.news-tile {
    position: relative;
    width: var(--tile-width);
    height: var(--tile-height);
    border-radius: var(--tile-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.news-tile:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.news-tile:active {
    transform: scale(0.98);
}

/* Tile Background Image */
.news-tile-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.news-tile-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.85) 0%,
            rgba(0, 0, 0, 0.5) 40%,
            rgba(0, 0, 0, 0.2) 100%);
}

/* Tile Content */
.news-tile-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

/* Brand / Publication */
.news-tile-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.news-tile-brand-icon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--news-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

.news-tile-brand-name {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: -0.1px;
}

/* Headline */
.news-tile-headline {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1.25;
    letter-spacing: -0.2px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* News App Icon Indicator */
.news-tile-app-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    z-index: 3;
}

.news-tile-app-icon svg {
    width: 100%;
    height: 100%;
    fill: rgba(255, 255, 255, 0.9);
}

/* Widget Row (for layout) */
.widget-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Large Widget Variant */
.news-tile.large {
    --tile-width: 352px;
    --tile-height: 170px;
}

.news-tile.large .news-tile-headline {
    font-size: 16px;
    -webkit-line-clamp: 2;
}

/* Dock */
.iphone-dock {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 32px;
}

.dock-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, #5ac8fa 0%, #007aff 100%);
}

/* Home Indicator */
.home-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 134px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

/* Empty Tile State */
.news-tile-empty {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

.news-tile-empty-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 12px;
}

/* Share Mode Adjustments */
.share-mode .iphone-frame {
    box-shadow:
        0 0 0 2px #2a2a2a,
        0 0 0 4px #1a1a1a,
        0 25px 80px rgba(0, 0, 0, 0.5);
}

/* Mobile: Full Screen Mode */
@media (max-width: 768px) {
    .share-mode {
        padding: 0;
    }

    .share-mode .iphone-frame {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    .share-mode .iphone-screen {
        border-radius: 0;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .share-mode .dynamic-island {
        /* Keep dynamic island on real devices */
    }
}

/* Scaled Preview Mode for Editor */
.editor-preview .iphone-container {
    transform-origin: top center;
}

.editor-preview .iphone-frame {
    --iphone-width: 300px;
    --iphone-height: 648px;
    --iphone-radius: 47px;
    --tile-width: 170px;
    --tile-height: 170px;
    --tile-radius: 20px;
    --dynamic-island-width: 108px;
    --dynamic-island-height: 31px;
}

/* Animations */
@keyframes tileAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.news-tile {
    animation: tileAppear 0.4s ease-out;
}

/* Tap Ripple Effect */
.news-tile.tapping::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: inherit;
    animation: tapRipple 0.3s ease-out forwards;
}

@keyframes tapRipple {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}