/* Apple App Store Components */

/* ========== NAVIGATION SIDEBAR ========== */
.navigation-sidebar {
    position: fixed;
    top: 16px;
    left: 16px;
    bottom: 16px;
    width: var(--sidebar-width);
    height: calc(100vh - 32px);
    background: var(--navSidebarBG);
    border: 2px solid var(--borderColor);
    border-radius: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: transform var(--transition-base);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.navigation-header {
    padding: var(--space-20) var(--space-20) var(--space-16);
    border-bottom: var(--keylineBorder);
    position: sticky;
    top: 0;
    background: var(--navSidebarBG);
    z-index: 10;
}

.sidebar-brand {
    transition: opacity var(--transition-fast);
}

.sidebar-brand:hover {
    opacity: 0.7;
}

.app-store-logo {
    margin-bottom: var(--space-12);
}

.app-store-logo svg {
    width: 121px;
    height: 21px;
    color: var(--systemPrimary);
}

.platform-selector {
    font-size: var(--fs-callout);
    font-weight: var(--fw-semibold);
    color: var(--systemSecondary);
    margin-bottom: var(--space-16);
}

/* Search Bar */
.search-container {
    margin-top: var(--space-12);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: var(--space-10);
    width: 16px;
    height: 16px;
    fill: var(--systemTertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: var(--space-8) var(--space-10) var(--space-8) 36px;
    background: var(--systemQuaternary);
    border: 1px solid transparent;
    border-radius: var(--radius-medium);
    font-size: var(--fs-callout);
    color: var(--systemPrimary);
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: var(--systemTertiary);
}

.search-input:focus {
    outline: none;
    background: var(--cardBg);
    border-color: var(--keyColor);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* Navigation Content */
.navigation-content {
    padding: var(--space-16) 0;
    flex: 1;
}

.navigation-items-primary {
    padding: 0 var(--space-12) var(--space-16);
    border-bottom: var(--keylineBorder);
}

.navigation-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.navigation-item {
    border-radius: var(--radius-medium);
    transition: background var(--transition-fast);
}

.navigation-item:hover {
    background: var(--systemQuaternary);
}

.navigation-item.active {
    background: var(--systemQuaternary);
}

.navigation-link {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    padding: var(--space-8) var(--space-12);
    font-size: var(--fs-body);
    font-weight: var(--fw-regular);
    color: var(--systemPrimary);
    transition: color var(--transition-fast);
}

.navigation-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.navigation-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.navigation-icon .material-symbols-outlined {
    font-size: 20px;
    color: currentColor;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 20;
}

.navigation-text {
    flex: 1;
}

/* Categories Section */
.navigation-section {
    padding: var(--space-16) var(--space-12);
}

.navigation-section-title {
    font-size: var(--fs-footnote);
    font-weight: var(--fw-semibold);
    color: var(--systemTertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-12);
    padding: 0 var(--space-12);
}

.categories-list .navigation-link {
    font-size: var(--fs-callout);
    padding: var(--space-6) var(--space-12);
}

/* ========== THEME TOGGLE ========== */
.theme-toggle-container {
    position: sticky;
    bottom: 0;
    padding: var(--space-16) var(--space-12);
    background: var(--navSidebarBG);
    border-top: var(--keylineBorder);
    margin-top: auto;
}

.theme-toggle-button {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    width: 100%;
    padding: var(--space-10) var(--space-12);
    background: var(--systemQuaternary);
    border: none;
    border-radius: var(--radius-medium);
    font-size: var(--fs-body);
    font-weight: var(--fw-regular);
    color: var(--systemPrimary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle-button:hover {
    background: var(--systemQuaternary);
    opacity: 0.8;
}

.theme-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--keyColor);
}

.theme-icon-sun {
    display: none;
}

.theme-icon-moon {
    display: block;
}

html[data-theme="dark"] .theme-icon-sun {
    display: block;
}

html[data-theme="dark"] .theme-icon-moon {
    display: none;
}

.theme-toggle-text {
    flex: 1;
    text-align: left;
}

/* ========== APP CARDS ========== */
.app-card {
    background: var(--cardBg);
    border: 1px solid var(--borderColorLight);
    border-radius: var(--radius-xlarge);
    padding: var(--space-16);
    display: flex;
    gap: var(--space-16);
    transition: all var(--transition-base);
    cursor: pointer;
    box-shadow: var(--shadowSmall);
    position: relative;
}

.platform-icons {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.platform-icon {
    width: 15px;
    height: 15px;
    object-fit: contain;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    border: 1px solid #272727;
    border-radius: 4px;
    padding: 2px;
    background: transparent;
}

/* White background for platform icons in dark theme */
html[data-theme="dark"] .platform-icon {
    background: #ffffff;
}

.app-card:hover .platform-icon {
    opacity: 0.9;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadowMedium);
    border-color: var(--borderColor);
}

.app-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-large);
    flex-shrink: 0;
    overflow: hidden;
    background: var(--systemQuaternary);
    border: 1px solid var(--borderColorLight);
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-width: 0;
}

.app-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-12);
}

.app-name {
    font-size: var(--fs-title3);
    font-weight: var(--fw-semibold);
    color: var(--systemPrimary);
    line-height: var(--lh-title3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.app-subtitle {
    font-size: var(--fs-callout);
    color: var(--systemSecondary);
    line-height: var(--lh-callout);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-description {
    font-size: var(--fs-callout);
    color: var(--systemSecondary);
    line-height: var(--lh-bodyTall);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-button {
    align-self: flex-start;
    padding: var(--space-6) var(--space-20);
    background: var(--systemQuaternary);
    border-radius: var(--radius-xxlarge);
    font-size: var(--fs-callout);
    font-weight: var(--fw-semibold);
    color: var(--keyColor);
    transition: all var(--transition-fast);
    margin-top: auto;
}

.app-button:hover {
    background: var(--systemQuaternary);
    transform: scale(1.02);
}

/* ========== APP CARDS COMPACT ========== */
.app-card-compact {
    background: var(--cardBg);
    border: 1px solid var(--borderColorLight);
    border-radius: var(--radius-xlarge);
    padding: var(--space-16);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-16);
    transition: all var(--transition-base);
    cursor: pointer;
    box-shadow: var(--shadowSmall);
}

.app-card-compact:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadowMedium);
    border-color: var(--borderColor);
}

.app-card-compact .app-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-large);
    flex-shrink: 0;
    overflow: hidden;
    background: var(--systemQuaternary);
    border: 1px solid var(--borderColorLight);
}

.app-card-compact .app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-card-compact .app-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    /* OLD: min-width: 0; - was causing text truncation */
    min-width: 0;
    overflow: hidden;
    /* Don't use justify-content: center here - let parent align-items handle centering */
}

.app-card-compact .app-name {
    font-size: var(--fs-title3);
    font-weight: var(--fw-semibold);
    color: var(--systemPrimary);
    line-height: var(--lh-title3);
    /* Allow wrapping instead of truncating */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    /* OLD truncating styles:
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    */
}

.app-card-compact .app-category {
    font-size: var(--fs-callout);
    color: var(--systemSecondary);
    line-height: var(--lh-callout);
    margin-top: -2px;
    text-transform: capitalize;
}

.app-card-compact .app-button {
    /* OLD: align-self: flex-start; - was inside info container */
    /* Button now sits on the right side of the card */
    flex-shrink: 0;
    align-self: center;
    padding: var(--space-6) var(--space-20);
    background: var(--systemQuaternary);
    border-radius: var(--radius-xxlarge);
    font-size: var(--fs-callout);
    font-weight: var(--fw-semibold);
    color: var(--keyColor);
    transition: all var(--transition-fast);
    /* Override inherited margin-top: auto from .app-button */
    margin-top: 0;
}

.app-card-compact .app-button:hover {
    background: var(--systemQuaternary);
    transform: scale(1.02);
}

/* ========== SKELETON LOADING ========== */
.skeleton,
.skeleton-card {
    pointer-events: none;
    user-select: none;
}

.skeleton-line,
.skeleton-icon,
.skeleton-content {
    background: linear-gradient(
        90deg,
        var(--systemQuaternary) 0%,
        var(--systemQuinary) 50%,
        var(--systemQuaternary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-small);
}

.skeleton-line {
    height: 14px;
    margin: var(--space-6) 0;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-large);
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

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

/* ========== HERO SECTION ========== */
.hero-section {
    margin-bottom: var(--space-40);
    border-radius: var(--radius-xlarge);
    overflow: hidden;
}

.hero-card {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: var(--space-40) var(--space-32);
    min-height: 400px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.hero-title {
    font-size: var(--fs-largeTitle);
    font-weight: var(--fw-bold);
    color: var(--label-inverse);
    line-height: var(--lh-largeTitle);
    margin-bottom: var(--space-12);
}

.hero-subtitle {
    font-size: var(--fs-title2);
    color: var(--label-inverse);
    opacity: 0.9;
    line-height: var(--lh-title2);
    margin-bottom: var(--space-20);
}

.hero-creator {
    font-size: var(--fs-callout);
    color: var(--label-inverse);
    opacity: 0.85;
    line-height: 1.6;
    margin-top: var(--space-16);
}

.hero-link {
    position: relative;
    display: inline-block;
    /* OLD STYLING (fixed yellow gradient): */
    /* color: var(--label-inverse); */
    /* background: linear-gradient(120deg, rgba(255, 214, 10, 0.7) 0%, rgba(255, 184, 0, 0.8) 100%); */
    /* box-shadow: 0 2px 8px rgba(255, 214, 10, 0.3); */
    /* NEW STYLING (theme-aware black/white): */
    color: #ffffff;
    font-weight: var(--fw-semibold);
    text-decoration: none;
    padding: 2px 10px;
    margin: 0 2px;
    transition: all var(--transition-normal);
    background: rgba(0, 0, 0, 0.75);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Dark theme - use light background */
html[data-theme="dark"] .hero-link {
    color: #000000;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.hero-link:nth-child(2) {
    transform: rotate(0.5deg);
}

.hero-link:first-of-type {
    transform: rotate(-0.5deg);
}

.hero-link:hover {
    transform: rotate(0deg) translateY(-2px);
    /* OLD: box-shadow: 0 4px 16px rgba(255, 214, 10, 0.5); */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    opacity: 1;
}

html[data-theme="dark"] .hero-link:hover {
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.5);
}

/* Hero logos */
.hero-logos {
    display: inline-flex;
    gap: 0;
    margin-left: var(--space-12);
    align-items: center;
    vertical-align: middle;
    transition: gap 0.27s ease-in-out;
}

.hero-logo-link {
    display: inline-block;
    border-radius: var(--radius-medium);
    overflow: hidden;
    transition: transform 0.27s ease-in-out, margin 0.27s ease-in-out;
    vertical-align: middle;
}

.hero-logo-link:first-child {
    z-index: 2;
    transform: rotate(10deg);
}

.hero-logo-link:last-child {
    margin-left: -12px;
    z-index: 1;
}

.hero-logo-link:hover {
    transform: scale(1.1);
    z-index: 3;
}

.hero-logo-link:first-child:hover {
    transform: rotate(10deg) scale(1.1);
}

/* On hover over logos container, straighten Expatova and add gap */
.hero-logos:hover {
    gap: var(--space-8);
}

.hero-logos:hover .hero-logo-link:last-child {
    margin-left: 0;
}

.hero-logos:hover .hero-logo-link:first-child {
    transform: rotate(0deg);
}

.hero-logos:hover .hero-logo-link:first-child:hover {
    transform: rotate(0deg) scale(1.1);
}

.hero-logo {
    width: 40px;
    height: 40px;
    display: block;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-medium);
    object-fit: cover;
}

html[data-theme="dark"] .hero-logo {
    border-color: rgba(255, 255, 255, 0.2);
}

/* ========== SECTION HEADER ========== */
.section-header {
    margin-bottom: var(--space-24);
}

.section-title {
    font-size: var(--fs-title1);
    font-weight: var(--fw-bold);
    color: var(--systemPrimary);
    line-height: var(--lh-title1);
    margin-bottom: var(--space-6);
}

.section-subtitle {
    font-size: var(--fs-body);
    color: var(--systemSecondary);
    line-height: var(--lh-body);
}

/* ========== MOBILE TOP BAR ========== */
.mobile-top-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--navSidebarBG);
    border-bottom: 1px solid var(--borderColor);
    align-items: center;
    padding: 0 var(--space-16);
    z-index: 150;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.mobile-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 8px;
    transition: opacity var(--transition-fast);
}

.mobile-header-brand:hover {
    opacity: 0.7;
}

.mobile-logo {
    height: 28px;
    width: auto;
    display: block;
}

.mobile-app-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--label-primary);
    line-height: 1;
}

/* ========== MOBILE MENU ========== */
.mobile-menu-toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--keyColor);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ========== RESPONSIVE ========== */
/* OLD BREAKPOINT (mobile menu up to 1199px): */
/* @media (max-width: 1199px) { */
/* NEW BREAKPOINT (mobile menu only up to 1023px, iPad landscape uses desktop sidebar): */
@media (max-width: 1023px) {
    .mobile-top-bar {
        display: flex;
    }
    
    .navigation-sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: calc(100vh - 60px);
        border-radius: 0;
        border: none;
        border-top: 1px solid var(--borderColor);
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }
    
    .navigation-sidebar.active {
        transform: translateY(0);
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Hide logo and name in sidebar on mobile/tablet */
    .sidebar-brand {
        display: none !important;
    }
    
    /* Increase navigation link font sizes for mobile */
    .navigation-link {
        font-size: var(--fs-title3);
        padding: var(--space-12) var(--space-16);
    }
    
    .categories-list .navigation-link {
        font-size: var(--fs-body);
        padding: var(--space-10) var(--space-16);
    }
    
    .navigation-section-title {
        font-size: var(--fs-callout);
        padding: 0 var(--space-16);
    }
    
    /* Remove sticky positioning on mobile and add scrollable space after button */
    .theme-toggle-container {
        position: relative;
        padding-bottom: 120px;
        margin-bottom: env(safe-area-inset-bottom, 0);
    }
    
    /* Remove extra padding from navigation content */
    .navigation-content {
        padding-bottom: 0;
    }
    
    /* Hero section adjustments for mobile */
    .hero-card {
        min-height: 300px;
        padding: var(--space-32) var(--space-24);
    }
    
    .hero-title {
        font-size: var(--fs-title1);
    }
    
    .hero-subtitle {
        font-size: var(--fs-title3);
    }
}
