/* QRコードジェネレーター v2.3 - 1カラムレイアウト最適化 */
/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS変数（デザインシステム） */
:root {
    /* パステル調カラーパレット */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;
    
    --gray-50: #fefefe;
    --gray-100: #f8fafc;
    --gray-200: #f1f5f9;
    --gray-300: #e2e8f0;
    --gray-400: #cbd5e1;
    --gray-500: #94a3b8;
    --gray-600: #64748b;
    --gray-700: #475569;
    --gray-800: #334155;
    --gray-900: #1e293b;
    
    --success-500: #86efac;
    --success-600: #4ade80;
    --warning-500: #fbbf24;
    --error-500: #f87171;
    
    /* タイポグラフィ */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;
    
    /* スペーシング */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    
    /* ボーダー半径 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* シャドウ */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: #1f2937;
    background: linear-gradient(135deg, #fef7ed 0%, #fed7aa 25%, #fecaca 50%, #e0e7ff 75%, #f0f9ff 100%);
    min-height: 100vh;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-4);
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: var(--space-3);
}

/* ヘッダー */
header {
    text-align: center;
    color: #1f2937;
    position: relative;
}

header h1 {
    font-size: var(--font-size-4xl);
    font-weight: 800;
    margin-bottom: var(--space-2);
    background: linear-gradient(135deg, #1f2937 0%, #374151 50%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

header p {
    font-size: var(--font-size-lg);
    color: #4b5563;
    font-weight: 500;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
}

/* メインコンテンツ */
main {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius-2xl);
    padding: var(--space-5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    max-width: 800px;
    margin: 0 auto;
}

main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed, #ec4899);
}

/* 入力セクション */
.input-section {
    margin-bottom: var(--space-3);
}

.input-section label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: #374151;
    letter-spacing: -0.025em;
}

.label-icon {
    font-size: var(--font-size-xl);
    opacity: 0.7;
}

.input-wrapper {
    position: relative;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-2);
    font-size: var(--font-size-sm);
    color: #6b7280;
}

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

.toggle-logo-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    color: #374151;
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-logo-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.toggle-logo-btn.active {
    background: #4f46e5;
    border-color: #3730a3;
    color: white;
}

.btn-icon {
    font-size: var(--font-size-sm);
}

.btn-text {
    font-size: var(--font-size-xs);
}

.char-count {
    font-weight: 500;
}

.input-type {
    background: #e0e7ff;
    color: #3730a3;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#text-input {
    width: 100%;
    padding: var(--space-4);
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    min-height: 100px;
}

#text-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 4px 12px rgba(79, 70, 229, 0.15);
    background: white;
    transform: translateY(-1px);
}

#text-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* ロゴセクション */
.logo-section {
    margin-bottom: var(--space-6);
}

.logo-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: #374151;
    letter-spacing: -0.025em;
}

.logo-upload-area {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.logo-upload-area:hover {
    border-color: #4f46e5;
    background: rgba(79, 70, 229, 0.05);
}

.logo-upload-area.dragover {
    border-color: #4f46e5;
    background: rgba(79, 70, 229, 0.1);
    transform: scale(1.02);
}

.upload-placeholder {
    color: #6b7280;
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
    opacity: 0.7;
}

.upload-placeholder p {
    font-size: var(--font-size-base);
    font-weight: 500;
    margin: 0 0 var(--space-1) 0;
}

.upload-placeholder small {
    font-size: var(--font-size-sm);
    color: #9ca3af;
}

.logo-preview {
    position: relative;
    display: inline-block;
}

.logo-preview img {
    max-width: 80px;
    max-height: 80px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    object-fit: contain;
}

.remove-logo-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: #dc2626;
    color: white;
    font-size: var(--font-size-sm);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.remove-logo-btn:hover {
    background: #b91c1c;
    transform: scale(1.1);
}

/* QRコードセクション */
.qr-section {
    display: flex;
    justify-content: center;
    position: relative;
    align-items: center;
    padding: var(--space-4) 0;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--space-3);
    padding: var(--space-5);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    border-radius: var(--radius-2xl);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(229, 231, 235, 0.8);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 500px;
    transition: all 0.3s ease;
}

.qr-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 0 12px 20px -8px rgba(0, 0, 0, 0.1);
}

.qr-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.5) 100%);
    pointer-events: none;
}

.qr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    position: relative;
    z-index: 2;
}

.qr-header h3 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.qr-actions {
    display: flex;
    gap: var(--space-2);
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #4f46e5;
    color: white;
    transform: scale(1.1);
}

.qr-display {
    max-width: 320px;
    max-height: 320px;
    width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    min-height: 200px;
}

.qr-placeholder {
    text-align: center;
    color: #9ca3af;
    padding: var(--space-8);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: var(--space-3);
    opacity: 0.6;
}

.qr-placeholder p {
    font-size: var(--font-size-sm);
    margin: 0;
    font-weight: 500;
    color: #6b7280;
}

#qr-canvas canvas,
#qr-canvas svg,
#qr-canvas img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

#qr-canvas:hover canvas,
#qr-canvas:hover svg,
#qr-canvas:hover img {
    transform: scale(1.02);
}

.download-section {
    text-align: center;
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.download-section h4 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: #374151;
    margin-bottom: var(--space-4);
}

/* ダウンロードボタン */
.download-buttons {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-3);
}

.download-btn {
    padding: var(--space-4) var(--space-5);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: -0.025em;
    position: relative;
    overflow: hidden;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    text-align: center;
}

.download-btn::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 ease;
}

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

.png-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.png-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.svg-btn {
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.svg-btn:hover {
    background: linear-gradient(135deg, #3730a3, #312e81);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.download-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-1);
}

.btn-text {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.btn-desc {
    font-size: var(--font-size-xs);
    opacity: 0.8;
    font-weight: 400;
}

/* フッター */
footer {
    text-align: center;
    color: #6b7280;
    font-size: var(--font-size-sm);
}

/* ローディング状態 */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* エラーメッセージ */
.error-message {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #dc2626;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin: var(--space-4) 0;
    border-left: 4px solid #dc2626;
    font-weight: 500;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .container {
        padding: var(--space-3);
        gap: var(--space-2);
    }
    
    main {
        padding: var(--space-4);
        max-width: 100%;
    }
    
    header h1 {
        font-size: var(--font-size-3xl);
    }
    
    header p {
        font-size: var(--font-size-base);
    }
    
    .logo-upload-area {
        padding: var(--space-4);
    }
    
    .qr-container {
        max-width: 400px;
    }
    
    .download-buttons {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .download-btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--space-2);
    }
    
    header h1 {
        font-size: var(--font-size-3xl);
    }
    
    header p {
        font-size: var(--font-size-base);
    }
    
    main {
        padding: var(--space-3);
        gap: var(--space-3);
    }
    
    .download-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .download-btn {
        width: 100%;
        max-width: 280px;
    }
    
    .qr-container {
        max-width: 300px;
    }
    
    .logo-upload-area {
        padding: var(--space-3);
    }
    
    .logo-preview img {
        max-width: 60px;
        max-height: 60px;
    }
    
    .qr-display {
        max-width: 280px;
        max-height: 280px;
    }
    
    .input-actions {
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-end;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: var(--font-size-2xl);
    }
    
    header p {
        font-size: var(--font-size-sm);
    }
    
    main {
        padding: var(--space-2);
    }
    
    .qr-display {
        max-width: 200px;
    }
    
    .qr-container {
        padding: var(--space-3);
        min-width: 240px;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.qr-container {
    animation: slideUp 0.6s ease-out;
}

main {
    animation: fadeIn 0.8s ease-out;
}

header {
    animation: slideUp 0.4s ease-out;
}

/* ホバーエフェクト */
.download-btn:hover {
    animation: pulse 0.6s ease-in-out;
}
