/* Import iOS Design System */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* iOS Color Palette */
    --ios-blue: #007AFF;
    --ios-orange: #FF9500;
    --ios-red: #FF3B30;
    --ios-green: #34C759;
    --ios-purple: #AF52DE;
    --ios-pink: #FF2D55;

    /* UI Colors - Premium Light Mode */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-elevated: rgba(255, 255, 255, 1);
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --accent: #000000;
    --accent-gradient: linear-gradient(135deg, #000000 0%, #343a40 100%);
    --separator: rgba(0, 0, 0, 0.08);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* Shadows - Softer for Light Mode */
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(0, 0, 0, 0.03) 0, transparent 50%),
        radial-gradient(at 100% 0%, rgba(0, 0, 0, 0.02) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 0, 0, 0.03) 0, transparent 50%),
        radial-gradient(at 0% 100%, rgba(0, 0, 0, 0.02) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Icon Alignment and Typography fixes */
.material-icons {
    user-select: none;
    vertical-align: middle;
}

.tips-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.tips-list .material-icons {
    font-size: 20px;
    margin-top: 2px;
}

/* Header */
.qr-header {
    background: rgba(10, 10, 12, 0.6);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-bottom: 1px solid var(--separator);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: var(--spacing-sm) 0;
    animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-btn,
.download-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    background: rgba(58, 58, 60, 0.6);
    border: 0.5px solid var(--separator);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.back-btn:hover,
.download-btn:hover:not(:disabled) {
    background: rgba(58, 58, 60, 0.8);
    transform: scale(1.02);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qr-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

/* Main Layout */
.qr-main {
    padding: var(--spacing-xl) 0;
}

.qr-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: start;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.input-card,
.tips-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--separator);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tips-card {
    animation-delay: 0.2s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header,
.tips-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.card-header .material-icons,
.tips-header .material-icons {
    font-size: 28px;
    color: var(--accent);
}

.card-header h2,
.tips-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.input-group {
    margin-bottom: var(--spacing-md);
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .material-icons {
    position: absolute;
    left: var(--spacing-sm);
    color: var(--text-muted);
    font-size: 20px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: var(--spacing-sm);
    padding-left: calc(var(--spacing-sm) * 3);
    background: var(--bg-elevated);
    border: 0.5px solid var(--separator);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition-fast);
}

.input-group input:not(.input-wrapper input) {
    padding-left: var(--spacing-sm);
}

.input-group select {
    padding-left: var(--spacing-sm);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.generate-btn {
    width: 100%;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.generate-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.loading-state {
    text-align: center;
    padding: var(--spacing-lg);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--separator);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--spacing-sm);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.section-divider {
    text-align: center;
    margin: var(--spacing-lg) 0;
    position: relative;
}

.section-divider::before,
.section-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 0.5px;
    background: var(--separator);
}

.section-divider::before {
    left: 0;
}

.section-divider::after {
    right: 0;
}

.section-divider span {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 0 var(--spacing-sm);
}

/* Tips Card */
.tips-list {
    list-style: none;
}

.tips-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tips-list .material-icons {
    font-size: 20px;
    color: var(--ios-green);
    flex-shrink: 0;
}

/* Preview Section */
.preview-section {
    position: sticky;
    top: calc(var(--spacing-xl) + 80px);
}

.preview-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.preview-header .material-icons {
    font-size: 24px;
    color: var(--accent);
}

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.card-preview {
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

/* AI Thinking Loader */
.ai-thinking {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    width: 100%;
}

.thinking-dots {
    display: flex;
    gap: 10px;
}

.thinking-dot {
    width: 12px;
    height: 12px;
    background: var(--ios-blue);
    border-radius: 50%;
    animation: thinking-pulse 1.4s infinite ease-in-out both;
}

.thinking-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking-pulse {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.thinking-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
}

.empty-state .material-icons {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.empty-state p {
    font-size: 0.875rem;
}

/* Generated QR Card */
.qr-card {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
}

.qr-card-header {
    padding: var(--spacing-xl);
    color: white;
    text-align: center;
}

.qr-card-header h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.02em;
}

.qr-card-header p {
    font-size: 1.25rem;
    font-weight: 500;
    opacity: 0.95;
}

.qr-card-body {
    background: white;
    padding: var(--spacing-xl);
    position: relative;
}

.phone-mockup {
    position: relative;
    width: 280px;
    margin: 0 auto var(--spacing-lg);
}

.phone-frame {
    background: #1C1C1E;
    border-radius: 40px;
    padding: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.phone-screen {
    background: linear-gradient(135deg, #FFF5F5 0%, #FFE8E8 100%);
    border-radius: 32px;
    padding: var(--spacing-lg);
    text-align: center;
    position: relative;
}

.scan-label {
    background: #FF9500;
    color: white;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    display: inline-block;
    margin-bottom: var(--spacing-md);
}

.qr-code-container {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    position: relative;
}

.qr-code-container canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
    border-radius: 8px;
}

.app-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: white;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.app-icon-overlay img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.app-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: #333;
    font-weight: 600;
}

.app-stats .star {
    color: #FF9500;
}

.instructions {
    margin-top: var(--spacing-lg);
}

.instructions h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
    margin-bottom: var(--spacing-md);
}

.instruction-list {
    list-style: none;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.instruction-number {
    width: 36px;
    height: 36px;
    background: #EF5350;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.instruction-text {
    flex: 1;
}

.instruction-text strong {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 2px;
}

.instruction-text span {
    font-size: 0.875rem;
    color: #666;
}

.qr-card-footer {
    background: #FF9500;
    padding: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.developer-info {
    color: white;
}

.developer-info h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.developer-info p {
    font-size: 0.875rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.play-store-badge {
    display: flex;
    align-items: center;
}

.play-store-img {
    height: 40px;
    width: auto;
    display: block;
}

/* Responsive */
@media (max-width: 1024px) {
    .qr-layout {
        grid-template-columns: 1fr;
    }

    .preview-section {
        position: static;
    }
}

@media (max-width: 640px) {
    .qr-card {
        max-width: 100%;
    }

    .phone-mockup {
        width: 240px;
    }

    .qr-card-header h2 {
        font-size: 2rem;
    }
}