/* Apple Design System - Muru AI Model Hub */
:root {
    /* Apple-inspired color palette */
    --apple-blue: #007AFF;
    --apple-indigo: #5856D6;
    --apple-purple: #AF52DE;
    --apple-pink: #FF2D55;
    --apple-red: #FF3B30;
    --apple-orange: #FF9500;
    --apple-yellow: #FFCC00;
    --apple-green: #34C759;
    --apple-teal: #5AC8FA;
    --apple-cyan: #32ADE6;
    
    /* Neutral colors */
    --gray-100: #F5F5F7;
    --gray-200: #E8E8ED;
    --gray-300: #D2D2D7;
    --gray-400: #A1A1A6;
    --gray-500: #6E6E73;
    --gray-600: #48484A;
    --gray-700: #3A3A3C;
    --gray-800: #2C2C2E;
    --gray-900: #1C1C1E;
    
    /* Semantic colors */
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    --accent: #007AFF;
    --accent-glow: rgba(0, 122, 255, 0.4);
    
    /* Glass morphism */
    --glass-bg: rgba(28, 28, 30, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Dynamic Ambient Background */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--apple-purple) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--apple-blue) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--apple-pink) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 50px) scale(0.95);
    }
    75% {
        transform: translate(-50px, -20px) scale(1.05);
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Glass Header */
.glass-header {
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 48px 0 32px;
    text-align: center;
    position: relative;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    color: var(--text-primary);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.glass-header h1 {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -0.003em;
    background: linear-gradient(135deg, #FFFFFF 0%, #A1A1A6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 21px;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.011em;
}

/* Navigation - Dropdown Style */
.modality-nav {
    background: transparent;
    padding: 32px 0;
    margin-bottom: 0;
}

.dropdown-nav {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.dropdown {
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 140px;
    justify-content: space-between;
}

.dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.dropdown-trigger.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.dropdown-arrow {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.3s ease;
}

.dropdown.open .dropdown-arrow {
    transform: rotate(-135deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 180px;
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.dropdown-item.active {
    background: rgba(0, 122, 255, 0.2);
    color: var(--apple-blue);
}

/* Section Title */
.section-title {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.section-title h2 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.021em;
    color: var(--text-primary);
}

/* Model Grid */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

/* Model Card - Apple Card Style */
.model-card {
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.model-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.model-card:hover {
    transform: translateY(-4px) scale(1.01);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.model-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 25px 50px -12px rgba(0, 122, 255, 0.25);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.provider-badge {
    font-size: 11px;
    background: rgba(0, 122, 255, 0.15);
    color: var(--apple-blue);
    padding: 4px 10px;
    border-radius: 980px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.category-badge {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-tertiary);
    padding: 4px 10px;
    border-radius: 980px;
    font-weight: 500;
}

.model-card h4 {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.021em;
}

.description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex-grow: 1;
    line-height: 1.5;
}

.api-key-section {
    margin-bottom: 16px;
}

.api-key-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--apple-blue);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid rgba(0, 122, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 122, 255, 0.1);
    transition: all 0.2s ease;
}

.api-key-link:hover {
    background: rgba(0, 122, 255, 0.2);
    border-color: rgba(0, 122, 255, 0.5);
    color: #fff;
}

.api-key-icon {
    width: 12px;
    height: 12px;
}

.price-info {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.price-item span {
    font-weight: 600;
    color: var(--apple-green);
}

/* Call Method Panel */
.call-method-panel {
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: 24px;
    margin-bottom: 60px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    position: relative;
}

.call-method-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.panel-header {
    background: transparent;
    padding: 24px 32px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 19px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.021em;
}

.hint {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 400;
}

.panel-content {
    padding: 32px;
    min-height: 200px;
}

.placeholder-text {
    text-align: center;
    color: var(--text-tertiary);
    padding: 60px 40px;
    font-size: 17px;
}

.detail-item {
    margin-bottom: 24px;
}

.detail-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.code-wrapper {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 20px;
    border-radius: 12px;
    position: relative;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 13px;
    overflow-x: auto;
    border: 1px solid var(--glass-border);
}

pre {
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.btn-copy {
    position: absolute;
    right: 12px;
    top: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: var(--accent);
    color: white;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading-spinner::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--glass-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton Loading */
.skeleton-card {
    pointer-events: none;
}

.skeleton-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.skeleton-badge {
    width: 60px;
    height: 22px;
    background: linear-gradient(90deg, var(--gray-700) 25%, var(--gray-600) 50%, var(--gray-700) 75%);
    background-size: 200% 100%;
    border-radius: 980px;
    animation: shimmer 1.5s infinite;
}

.skeleton-badge.small {
    width: 50px;
}

.skeleton-title {
    width: 70%;
    height: 24px;
    background: linear-gradient(90deg, var(--gray-700) 25%, var(--gray-600) 50%, var(--gray-700) 75%);
    background-size: 200% 100%;
    border-radius: 6px;
    margin-bottom: 12px;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    width: 100%;
    height: 16px;
    background: linear-gradient(90deg, var(--gray-700) 25%, var(--gray-600) 50%, var(--gray-700) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 8px;
    animation: shimmer 1.5s infinite;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-price {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.skeleton-price-item {
    width: 80px;
    height: 16px;
    background: linear-gradient(90deg, var(--gray-700) 25%, var(--gray-600) 50%, var(--gray-700) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.hidden {
    display: none;
}

/* Minimal Footer */
.minimal-footer {
    background: transparent;
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--glass-border);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.brand-divider {
    width: 4px;
    height: 4px;
    background: var(--text-tertiary);
    border-radius: 50%;
}

.copyright {
    font-size: 14px;
    color: var(--text-tertiary);
}

.admin-link {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-tertiary);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.admin-link:hover {
    opacity: 1;
    color: var(--text-secondary);
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    /* Header */
    .glass-header {
        padding: 32px 0 24px;
    }
    
    .logo {
        gap: 12px;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
    }
    
    .glass-header h1 {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 15px;
        padding: 0 20px;
    }
    
    /* Navigation */
    .modality-nav {
        padding: 20px 0;
    }
    
    .dropdown-nav {
        flex-direction: column;
        gap: 12px;
        padding: 0 16px;
    }
    
    .dropdown {
        width: 100%;
    }
    
    .dropdown-trigger {
        width: 100%;
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .dropdown-menu {
        width: 100%;
        left: 0;
        right: 0;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .dropdown-item {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    /* Main Content */
    .container {
        padding: 0 16px;
    }
    
    .section-title {
        margin-bottom: 16px;
    }
    
    .section-title h2 {
        font-size: 22px;
    }
    
    /* Model Grid */
    .model-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 40px;
    }
    
    .model-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .model-card h4 {
        font-size: 17px;
    }
    
    .description {
        font-size: 13px;
        margin-bottom: 16px;
    }
    
    .price-info {
        flex-direction: column;
        gap: 8px;
        padding-top: 12px;
    }
    
    .price-item {
        font-size: 12px;
    }
    
    /* Call Method Panel */
    .call-method-panel {
        border-radius: 16px;
        margin-bottom: 40px;
    }
    
    .panel-header {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .panel-header h3 {
        font-size: 17px;
    }
    
    .hint {
        font-size: 12px;
    }
    
    .panel-content {
        padding: 20px;
    }
    
    .detail-item {
        margin-bottom: 20px;
    }
    
    .detail-item label {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .code-wrapper {
        padding: 16px;
        font-size: 12px;
        border-radius: 10px;
    }
    
    .btn-copy {
        position: relative;
        right: auto;
        top: auto;
        margin-top: 12px;
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }
    
    /* Footer */
    .minimal-footer {
        padding: 30px 0;
    }
    
    .brand-mark {
        flex-direction: column;
        gap: 8px;
    }
    
    .brand-divider {
        display: none;
    }
    
    /* Ambient Background */
    .gradient-orb {
        filter: blur(80px);
        opacity: 0.3;
    }
    
    .orb-1 {
        width: 300px;
        height: 300px;
        top: -100px;
        right: -50px;
    }
    
    .orb-2 {
        width: 250px;
        height: 250px;
        bottom: -80px;
        left: -50px;
    }
    
    .orb-3 {
        width: 200px;
        height: 200px;
    }
    
    /* Skeleton Loading */
    .skeleton-card {
        padding: 20px;
    }
    
    .skeleton-title {
        width: 60%;
        height: 20px;
    }
    
    .skeleton-text {
        height: 14px;
    }
    
    .skeleton-price {
        flex-direction: column;
        gap: 8px;
    }
}

/* Small Phone */
@media (max-width: 375px) {
    .glass-header h1 {
        font-size: 24px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .model-card {
        padding: 16px;
    }
    
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .provider-badge,
    .category-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .model-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dropdown-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .dropdown {
        flex: 1;
        min-width: 140px;
        max-width: 200px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Touch Device Optimizations */
.touch-device .model-card {
    -webkit-tap-highlight-color: transparent;
}

.touch-device .dropdown-trigger,
.touch-device .dropdown-item {
    -webkit-tap-highlight-color: transparent;
}

/* Safe Area for Notch Devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .glass-header {
        padding-top: calc(48px + env(safe-area-inset-top));
    }
    
    .container {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
}

/* Prevent Text Selection on UI Elements */
.dropdown-trigger,
.dropdown-item,
.provider-badge,
.category-badge {
    -webkit-user-select: none;
    user-select: none;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Focus States for Accessibility */
.dropdown-trigger:focus,
.dropdown-item:focus,
.model-card:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .gradient-orb {
        animation: none;
    }
}
