/* AI チラシデザイナー - カスタムスタイル */

/* 基本リセット */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
}

/* Tailwind風ユーティリティクラス */
.max-w-7xl { max-width: 80rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.text-3xl { font-size: 1.875rem; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-gray-800 { color: #1f2937; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-white { background-color: #ffffff; }
.rounded-lg { border-radius: 0.5rem; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.gap-8 { gap: 2rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-center: center; }
.justify-between { justify-content: space-between; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.h-0 { height: 0; }
.h-20 { height: 5rem; }
.h-24 { height: 6rem; }
.h-32 { height: 8rem; }
.bg-blue-500 { background-color: #3b82f6; }
.bg-gray-300 { background-color: #d1d5db; }
.bg-purple-600 { background-color: #9333ea; }
.bg-gray-500 { background-color: #6b7280; }
.bg-red-500 { background-color: #ef4444; }
.bg-green-500 { background-color: #10b981; }
.bg-orange-500 { background-color: #f97316; }
.text-white { color: #ffffff; }
.text-gray-700 { color: #374151; }
.text-gray-500 { color: #6b7280; }
.rounded-full { border-radius: 9999px; }
.rounded { border-radius: 0.25rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.p-1 { padding: 0.25rem; }
.p-3 { padding: 0.75rem; }
.border { border-width: 1px; }
.border-gray-300 { border-color: #d1d5db; }
.ml-2 { margin-left: 0.5rem; }
.mr-1 { margin-left: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.pt-6 { padding-top: 1.5rem; }
.border-t { border-top-width: 1px; }
.text-xl { font-size: 1.25rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-medium { font-weight: 500; }
.block { display: block; }
.hidden { display: none; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.bg-black { background-color: #000000; }
.bg-opacity-50 { background-color: rgba(0, 0, 0, 0.5); }
.z-50 { z-index: 50; }
.text-4xl { font-size: 2.25rem; }
.text-6xl { font-size: 3.75rem; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 0.5rem; }
.relative { position: relative; }
.overflow-auto { overflow: auto; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; }
.hover\:bg-purple-700:hover { background-color: #7c3aed; }
.hover\:bg-gray-600:hover { background-color: #4b5563; }

@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* A4縦サイズのチラシキャンバス - 縦横比固定 */
.flyer-canvas {
    width: 100%;
    aspect-ratio: 210 / 297; /* A4縦横比を固定 */
    max-width: 400px; /* 最大幅を制限 */
    max-height: 80vh;
    border: 1px solid #ccc;
    position: relative;
    background: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin: 0 auto;
    overflow: hidden; /* はみ出し防止 */
}

/* ドラッグ可能要素 */
.draggable-element {
    position: absolute;
    cursor: move;
    border: 2px dashed transparent;
    padding: 4px;
    transition: border-color 0.2s ease;
}

.draggable-element:hover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
}

.draggable-element.selected {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

/* 要素コントロール */
.element-controls {
    position: absolute;
    top: -30px;
    right: 0;
    display: none;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 4px;
    padding: 2px;
    z-index: 10;
}

/* テキスト編集モード */
.text-editing {
    outline: 2px solid #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
    cursor: text !important;
}

.text-editing:focus {
    outline: 2px solid #1d4ed8 !important;
}

.draggable-element.selected .element-controls {
    display: flex;
}

/* リサイズハンドル */
.resize-handle {
    position: absolute;
    background: #3b82f6;
    border: 2px solid white;
    width: 8px;
    height: 8px;
    z-index: 20;
}

.resize-handle.nw {
    top: -4px;
    left: -4px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -4px;
    right: -4px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -4px;
    left: -4px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -4px;
    right: -4px;
    cursor: se-resize;
}

/* レイヤーコントロール */
.layer-controls {
    position: absolute;
    top: -60px;
    left: 0;
    display: none;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 4px;
    padding: 2px;
    z-index: 10;
}

.draggable-element.selected .layer-controls {
    display: flex;
}

/* フォームスタイル */
.form-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

/* ボタンスタイル */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: #8b5cf6;
    color: white;
}

.btn-primary:hover {
    background-color: #7c3aed;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

/* ステップインジケーター */
.step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.step-item {
    display: flex;
    align-items: center;
    font-size: 14px;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 8px;
}

.step-number.active {
    background-color: #3b82f6;
    color: white;
}

.step-number.inactive {
    background-color: #d1d5db;
    color: #6b7280;
}

.step-connector {
    width: 32px;
    height: 2px;
    background-color: #d1d5db;
    margin: 0 16px;
}

/* ローディングオーバーレイ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    font-size: 3rem;
    color: #8b5cf6;
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* タブスタイル */
.tab-container {
    display: flex;
    margin-bottom: 1rem;
}

.tab-button {
    padding: 8px 16px;
    border: none;
    background-color: #e5e7eb;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-button:first-child {
    border-radius: 6px 0 0 6px;
}

.tab-button:last-child {
    border-radius: 0 6px 6px 0;
}

.tab-button.active {
    background-color: #3b82f6;
    color: white;
}

.tab-button:hover:not(.active) {
    background-color: #d1d5db;
}

/* 編集ツールバー */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.toolbar-button {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.toolbar-button i {
    margin-right: 4px;
}

/* コピー表示エリア */
.copy-display {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.copy-section {
    margin-bottom: 1rem;
}

.copy-section:last-child {
    margin-bottom: 0;
}

.copy-label {
    font-size: 14px;
    font-weight: 600;
    color: #8b5cf6;
    margin-bottom: 4px;
}

.copy-content {
    color: #374151;
    line-height: 1.5;
}

.feature-list {
    list-style-type: disc;
    padding-left: 1.2rem;
}

.feature-list li {
    margin-bottom: 4px;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .flyer-canvas {
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    .flyer-canvas {
        max-width: 300px;
    }
    
    .editor-toolbar {
        flex-direction: column;
    }
    
    .toolbar-button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .flyer-canvas {
        max-width: 250px;
    }
}

/* プリント用スタイル */
@media print {
    body * {
        visibility: hidden;
    }
    
    .flyer-canvas,
    .flyer-canvas * {
        visibility: visible;
    }
    
    .flyer-canvas {
        position: absolute;
        left: 0;
        top: 0;
        transform: none !important;
        width: 210mm;
        height: 297mm;
    }
    
    .draggable-element {
        border: none !important;
        background: none !important;
    }
    
    .element-controls {
        display: none !important;
    }
}