/* Linear.app Inspired Design System */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Linear Color Palette */
    --bg-primary: #0c0d0e;
    --bg-secondary: #151618;
    --bg-tertiary: #1c1d1f;
    --bg-card: #1a1b1d;
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(255, 255, 255, 0.08);
    
    --text-primary: #e8eaed;
    --text-secondary: #9ca0a8;
    --text-tertiary: #6b7280;
    --text-muted: #4b5563;
    
    --border-default: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);
    --border-strong: rgba(255, 255, 255, 0.12);
    
    --accent-purple: #7c3aed;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-pink: #ec4899;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Monaco, monospace;
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

/* Base Styles */
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Linear Navigation Bar */
.nav-linear {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(12, 13, 14, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-default);
    z-index: 1000;
}

.nav-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    max-width: 1280px;
    margin: 0 auto;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
}

.logo-icon {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 14px;
    height: 14px;
    fill: white;
}

.nav-center {
    flex: 1;
    max-width: 600px;
    margin: 0 var(--space-8);
}

.nav-search {
    width: 100%;
    position: relative;
}

.search-input {
    width: 100%;
    height: 32px;
    padding: 0 var(--space-8) 0 var(--space-8);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: var(--bg-secondary);
}

.search-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-nav {
    height: 32px;
    padding: 0 var(--space-3);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-nav:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-home {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    margin-right: var(--space-2);
}

.btn-home:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn-library {
    background: var(--accent-purple);
    color: white;
    border: none;
}

.btn-library:hover {
    background: #6d28d9;
}

/* Hero Section */
.hero-linear {
    padding: calc(48px + var(--space-20)) var(--space-6) var(--space-16);
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-linear::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(124, 58, 237, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-full);
    color: var(--accent-purple);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: var(--space-4);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-10);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
}

.btn-hero {
    height: 40px;
    padding: 0 var(--space-5);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-hero-primary {
    background: var(--accent-purple);
    color: white;
}

.btn-hero-primary:hover {
    background: #6d28d9;
    transform: translateY(-1px);
}

.btn-hero-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-hero-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

/* Features Grid */
.features-section {
    padding: var(--space-20) var(--space-6);
    background: var(--bg-secondary);
}

.features-container {
    max-width: 1200px;
    margin: 0 auto;
}

.features-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.features-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.features-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
    opacity: 0;
    transition: opacity 0.3s;
}

.feature-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    font-size: 24px;
}

.feature-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.feature-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Builder Section */
.builder-section {
    position: relative;
    padding: calc(48px + var(--space-16)) var(--space-6) var(--space-16);
    background: var(--bg-primary);
    z-index: 1;
    overflow: visible !important;
}

.builder-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    overflow: visible !important;
}

.builder-header {
    text-align: center;
    margin-bottom: var(--space-10);
}

.builder-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.builder-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
}

.builder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
    position: relative;
    z-index: auto;
    overflow: visible !important;
}

.builder-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    transition: all 0.2s;
    overflow: visible !important;
    z-index: auto;
    min-height: 120px;
}

.builder-card:hover {
    border-color: var(--accent-purple);
    background: var(--bg-tertiary);
}

.builder-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.builder-input,
.builder-select {
    width: 100%;
    height: 36px;
    padding: 0 var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
}

.builder-input:focus,
.builder-select:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: var(--bg-primary);
}

.builder-select {
    position: relative;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L5 5L9 1' stroke='%239ca0a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    z-index: 10;
}

/* Clean Select Dropdown Styling */
.builder-select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    position: relative;
    z-index: 100;
}

/* Style the dropdown options */
.builder-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 14px;
}

.builder-select option:checked {
    background: var(--bg-tertiary);
}

/* Focus state for cards with select */
.builder-card.select-focused {
    z-index: 50;
    position: relative;
}

/* Specific dropdown enhancements */
#base-prompt-dropdown,
#style-ref-dropdown,
#camera-movement,
#aspect-ratio {
    margin-top: var(--space-2);
}

/* Output Section */
.output-section {
    padding: var(--space-10) 0;
    background: var(--bg-secondary);
}

.output-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.output-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.output-title {
    font-size: 16px;
    font-weight: 600;
}

.output-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.output-display {
    min-height: 120px;
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.output-placeholder {
    color: var(--text-tertiary);
    text-align: center;
    font-style: italic;
}

.output-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.btn-copy {
    flex: 1;
    height: 36px;
    background: var(--accent-purple);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.btn-copy:hover:not(:disabled) {
    background: #6d28d9;
}

.btn-copy:disabled {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

/* Footer */
.footer-linear {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-default);
    padding: var(--space-12) var(--space-6);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

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

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: 16px;
}

.footer-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.footer-column h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--text-primary);
}

.footer-bottom {
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-default);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copyright {
    color: var(--text-tertiary);
    font-size: 13px;
}

.footer-socials {
    display: flex;
    gap: var(--space-3);
}

.social-link {
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.social-link:hover {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-center {
        display: none;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .features-grid,
    .builder-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: var(--space-3);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Templates Section */
.section {
    padding: var(--space-20) 0;
    background: var(--bg-primary);
}

.section-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-2);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
}

/* Template Card - 개선된 디자인 */
.template-card {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    text-align: left;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-purple), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.template-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.template-card:hover::before {
    opacity: 1;
}

.template-card:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

/* Template Icon - 그라디언트 배경 */
.template-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: var(--space-4);
    position: relative;
    overflow: hidden;
}

.template-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.template-card:hover .template-icon::after {
    opacity: 1;
}

/* 각 템플릿별 그라디언트 */
.gradient-dark {
    background: linear-gradient(135deg, #2a2a2e, #1a1a1e);
}

.gradient-pink {
    background: linear-gradient(135deg, #ec4899, #d946ef);
}

.gradient-green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.gradient-orange {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
}

/* Template Title */
.template-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
}

/* Template Description */
.template-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 호버 시 화살표 아이콘 추가 */
.template-card::after {
    content: '→';
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    font-size: 20px;
    color: var(--accent-purple);
    opacity: 0;
    transition: all 0.3s;
}

.template-card:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeIn 0.5s ease-out;
}

/* Action Buttons - Enhanced Design */
.action-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-10);
}

.action-group-secondary {
    display: flex;
    gap: var(--space-2);
}

/* Generate Button - Primary CTA */
.btn-generate {
    position: relative;
    background: linear-gradient(135deg, var(--accent-purple), #8b5cf6);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.2), 
                0 4px 6px -1px rgba(124, 58, 237, 0.3),
                0 10px 15px -3px rgba(124, 58, 237, 0.2);
    overflow: hidden;
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-generate:hover::before {
    left: 100%;
}

.btn-generate:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #8b5cf6, var(--accent-purple));
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3),
                0 10px 15px -3px rgba(124, 58, 237, 0.3),
                0 20px 25px -5px rgba(124, 58, 237, 0.2);
}

.btn-generate:active {
    transform: translateY(0);
}

.btn-generate-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    position: relative;
    z-index: 1;
}

.btn-icon-sparkle {
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: rotate(0deg) scale(1); }
    50% { opacity: 0.8; transform: rotate(180deg) scale(1.1); }
}

.btn-shortcut {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font-mono);
    margin-left: var(--space-2);
}

/* Ghost Buttons */
.btn-ghost {
    padding: var(--space-2) var(--space-3);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}