/* --- CORE PAGE VARIABLES --- */
:root {
    --ios-bg: #f2f2f7;
    --sidebar-bg: #e8e8ed;
    --ios-text: #1d1d1f;
    --ios-gray: #86868b;
    --ios-light-gray: #d1d1d6;
    --ios-blue: #0071e3;
    --ios-divider: #c7c7cc;
}

body { 
    margin: 0; 
    font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif; 
    background: #f2f2f7; 
}

/* Flex Layout */
.app-store-layout { 
    display: flex; 
    min-height: 100vh; 
    background: #f2f2f7;
}

/* CRITICAL FIX: Desktop Layout Offset for 290px Fixed Sidebar */
@media (min-width: 769px) {
    .app-store-layout {
        padding-left: 290px;
        flex-direction: row;
    }
}

.store-main-content { 
    flex: 1; 
    background: #f2f2f7; 
    padding: 0; 
    overflow-x: hidden; 
    width: 100%;
}

/* UPDATED: Increased padding to 60px for significantly more spacing */
.ios-web-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 60px 40px 60px; 
    background: transparent;
}

/* --- HERO BANNER --- */
.hero-wrapper { 
    width: 100%; 
    margin-bottom: 30px; 
    background: #ffffff;
}

.hero-banner { 
    position: relative; 
    width: 100%; 
    min-height: 280px;
    overflow: hidden; 
    display: flex; 
    align-items: center; 
    padding: 30px 60px; 
    box-sizing: border-box; 
}

.hero-bg-strip {
    position: absolute; 
    top: -50%; 
    left: -50%; 
    width: 200%; 
    height: 200%;
    background-position: center; 
    background-size: cover; 
    background-repeat: no-repeat;
    filter: blur(80px) brightness(0.7);
    z-index: 0; 
    transform: scale(1.2);
}

.hero-overlay {
    position: absolute; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
}

.hero-content { 
    position: relative; 
    z-index: 2; 
    display: flex; 
    flex-direction: row; 
    align-items: flex-start; 
    gap: 25px;
    width: 100%; 
    max-width: 1200px;
    margin: 0 auto; 
}

.hero-icon-wrapper { flex-shrink: 0; }
.hero-icon { width: 140px; height: 140px; border-radius: 32px; border: 1px solid rgba(255,255,255,0.2); box-shadow: 0 20px 40px rgba(0,0,0,0.4); display: block; }
.hero-text-content { flex: 1; padding-top: 5px; color: #fff; }
.hero-title { font-size: 28px; font-weight: 700; margin: 0 0 6px 0; line-height: 1.1; color: #ffffff; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.hero-subtitle { font-size: 16px; color: rgba(255,255,255,0.9); margin: 0 0 18px 0; font-weight: 500; }
.hero-actions { display: flex; align-items: center; gap: 12px; }
.hero-get-btn { background: #0071e3; color: #fff; padding: 8px 24px; border-radius: 18px; font-size: 14px; font-weight: 600; text-decoration: none; transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,113,227,0.4); }
.hero-get-btn:hover { background: #0077ed; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,113,227,0.5); }
.hero-price-label { font-size: 11px; color: rgba(255,255,255,0.7); }
.hero-share-btn { background: rgba(255,255,255,0.15); border: none; color: #fff; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(10px); transition: all 0.2s; }
.hero-share-btn:hover { background: rgba(255,255,255,0.25); transform: translateY(-1px); }
.hero-share-btn svg { width: 16px; height: 18px; }
.hero-cat-link { color: rgba(255,255,255,0.9); text-decoration: none; transition: color 0.2s; }
.hero-cat-link:hover { color: #ffffff; text-decoration: underline; }

/* --- HERO STATS BAR --- */
.hero-stats-bar { 
    display: flex; 
    justify-content: space-between; 
    padding: 18px 0; 
    border-bottom: 1px solid #d1d1d6;
    background: #ffffff;
    width: 100%; 
    max-width: 1200px;
    margin: 0 auto; 
}

.stat-block { 
    flex: 1; 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    min-height: 60px;
    min-width: 0;
    padding: 8px 5px;
}

.stat-block.border-left { border-left: 1px solid #e5e5ea; }
.stat-top { font-size: 20px; font-weight: 700; color: #1d1d1f; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.stat-star { font-size: 12px; color: #1d1d1f; }
.stat-caption { font-size: 10px; color: #8e8e93; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; }
.stat-number { line-height: 1; color: #1d1d1f; }
.stat-text-val { font-size: 17px; font-weight: 700; color: #1d1d1f; line-height: 1; }
.stat-more { font-size: 12px; font-weight: 600; color: #8e8e93; }

.stat-value-text {
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
    margin-top: 4px;
    line-height: 1.2;
    width: 100%;
    max-width: 100%;
    padding: 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-link { color: #1d1d1f; text-decoration: none; transition: color 0.2s; }
.stat-link:hover { color: var(--ios-blue); text-decoration: underline; }

/* --- CONTENT SECTIONS --- */
.section { padding: 30px 0; border-bottom: 1px solid rgba(0,0,0,0.08); background: transparent; margin-bottom: 0; }
.section:last-child { border-bottom: none; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }

/* FIXED: Force Section Titles to be Dark Grey */
h2, .section-title { 
    font-size: 22px; 
    font-weight: 700; 
    margin: 0; 
    color: #1d1d1f !important; /* Overrides dark mode white text */
}

.section-link { font-size: 16px; color: var(--ios-blue); text-decoration: none; }

/* --- UPDATED INFO SECTION (NEW) --- */
.updated-info-section {
    padding: 12px 0;
    color: #86868b;
    font-size: 13px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 15px;
}

.updated-icon {
    font-size: 14px;
    margin-right: 6px;
}

.updated-info-section strong {
    color: #1d1d1f;
    margin-left: 4px;
    font-weight: 600;
}

/* Screenshots */
.screenshots-section { padding-top: 20px !important; padding-bottom: 30px !important; }
.screenshots-container { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: #86868b #d1d1d6; }
.screenshot-frame { flex: 0 0 auto; width: 180px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(0,0,0,0.12); box-shadow: 0 2px 8px rgba(0,0,0,0.1); transition: transform 0.2s ease; background: #ffffff; }
.screenshot-frame img { width: 100%; height: auto; max-height: 320px; object-fit: cover; display: block; }

/* Downloads */
.download-links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; }
.download-link-card { display: flex; align-items: center; gap: 15px; padding: 15px 20px; background: rgba(255,255,255,0.6); border-radius: 12px; text-decoration: none; color: #1d1d1f; transition: all 0.2s; border: 1px solid rgba(0,0,0,0.06); }
.download-link-card:hover { background: #ffffff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.download-icon { font-size: 32px; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; background: var(--ios-blue); border-radius: 12px; flex-shrink: 0; }
.download-info { flex: 1; }
.download-title { font-size: 16px; font-weight: 600; color: #1d1d1f; margin-bottom: 4px; }
.download-version { font-size: 13px; color: #8e8e93; }
.download-arrow { font-size: 20px; color: var(--ios-blue); font-weight: 700; }

/* Description */
.desc-content { font-size: 15px; line-height: 1.5; color: var(--ios-text); overflow: hidden; position: relative; }
.desc-content.collapsed { max-height: 100px; mask-image: linear-gradient(black 60%, transparent 100%); -webkit-mask-image: linear-gradient(black 60%, transparent 100%); }
.more-btn { background: transparent; border: none; color: var(--ios-blue); font-size: 15px; float: right; margin-top: 5px; cursor: pointer; font-weight: 500; }
.version-text { font-size: 15px; color: var(--ios-gray); }
.release-notes { font-size: 15px; color: var(--ios-text); line-height: 1.5; }

/* Ratings */
.ratings-big-display { display: flex; gap: 40px; align-items: center; margin-bottom: 25px; }
.big-score { font-size: 56px; font-weight: 700; color: #1d1d1f; line-height: 1; }
.out-of { font-size: 14px; color: var(--ios-gray); font-weight: 600; margin-top: 4px; }
.rating-right { flex: 1; max-width: 350px; }
.rating-count-label { text-align: right; font-size: 13px; color: var(--ios-gray); margin-bottom: 4px; font-weight: 600; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.stars { width: 45px; text-align: right; font-size: 9px; color: var(--ios-gray); letter-spacing: 0.5px; }
.bar-bg { flex: 1; height: 4px; background: rgba(0,0,0,0.1); border-radius: 2px; }
.bar-fill { height: 100%; background: #8e8e93; border-radius: 2px; }

/* Interactive Rating */
.user-rating-container { background: #fff; border-radius: 12px; padding: 20px; text-align: center; border: 1px solid rgba(0,0,0,0.06); box-shadow: 0 4px 12px rgba(0,0,0,0.03); margin-top: 15px; }
.tap-to-rate-label { font-size: 14px; color: #86868b; margin-bottom: 12px; font-weight: 500; }
.user-stars { display: flex; justify-content: center; gap: 12px; direction: row; }
.rate-star { font-size: 36px; color: #d1d1d6; cursor: pointer; line-height: 1; transition: color 0.15s ease, transform 0.1s; }
.rate-star.filled, .rate-star.hover { color: #007AFF; }
.rate-star:active { transform: scale(1.2); }
.rating-message { margin-top: 10px; font-size: 14px; font-weight: 600; color: #007AFF; min-height: 20px; }
.rating-message.error { color: #FF3B30; }

/* Info Grid & Language Toggle */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 30px; margin: 0; }
.info-pair { display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid rgba(0,0,0,0.08); padding-bottom: 12px; }
.info-pair:nth-last-child(-n+2) { border-bottom: none; }
.info-pair dt { font-size: 14px; color: var(--ios-gray); font-weight: 500; }
.info-pair dd { font-size: 15px; color: var(--ios-text); margin: 0; }
.info-link { color: var(--ios-blue); text-decoration: none; font-weight: 500; transition: opacity 0.2s; }
.info-link:hover { opacity: 0.7; text-decoration: underline; }

/* Language Toggle Styles */
.lang-toggle-container { position: relative; }
.lang-preview { cursor: pointer; display: flex; align-items: center; gap: 5px; transition: opacity 0.2s; }
.lang-preview:hover { opacity: 0.7; }
.lang-chevron { font-size: 10px; color: var(--ios-gray); transition: transform 0.2s ease; margin-left: 4px; }
.lang-chevron.rotated { transform: rotate(180deg); }
.lang-full-list { display: none; margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--ios-text); background: rgba(0,0,0,0.03); padding: 8px 10px; border-radius: 8px; }

/* Related Grid */
.as-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }

/* FIXED: Explicitly set card background to White (overrides dark mode black) */
.as-card { 
    display: flex; 
    align-items: center; 
    padding: 15px; 
    border-radius: 16px; 
    text-decoration: none !important; 
    background-color: #FFFFFF !important; /* Force White Background */
    transition: all 0.3s; 
    overflow: hidden; 
    cursor: pointer; 
    position: relative; 
    border: 1px solid rgba(0,0,0,0.05); /* Subtle border for definition */
}

.as-card:hover { 
    background-color: #FFFFFF !important; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); 
    transform: translateY(-2px); 
}

.as-icon { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; margin-right: 15px; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.as-details { flex: 1; min-width: 0; overflow: hidden; }
.as-title { font-size: 16px; font-weight: 600; color: var(--ios-text); margin: 0 0 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-desc { font-size: 13px; color: var(--ios-gray); margin: 0 0 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-btn { background: #F0F0F5; color: var(--ios-blue); font-size: 13px; font-weight: 600; padding: 6px 18px; border-radius: 20px; text-transform: uppercase; margin-left: 10px; flex-shrink: 0; white-space: nowrap; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .app-store-layout { padding-left: 0; flex-direction: column; }
    .ios-web-container { padding: 0 20px 20px 20px; }
    .hero-banner { padding: 25px 18px; min-height: 220px; }
    .hero-content { gap: 18px; }
    .hero-icon { width: 115px; height: 115px; border-radius: 26px; }
    .hero-text-content { padding-top: 0; }
    .hero-title { font-size: 22px; margin-bottom: 5px; }
    .hero-subtitle { font-size: 14px; margin-bottom: 14px; }
    .hero-actions { gap: 10px; flex-wrap: wrap; }
    .hero-get-btn { padding: 7px 20px; font-size: 14px; border-radius: 17px; }
    .hero-stats-bar { overflow-x: auto; justify-content: flex-start; padding: 16px 12px; }
    .stat-block { min-width: 90px; padding: 6px 4px; }
    .rating-right { width: 100%; }
    .as-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .hero-icon { width: 95px; height: 95px; border-radius: 22px; }
    .hero-title { font-size: 19px; }
    .as-grid { grid-template-columns: 1fr; }
    .as-icon { width: 56px; height: 56px; }
}