/* 全体のスタイル */
body {
    background-color: #f8f9fa;
    color: #333;
}

.container {
    max-width: 1200px;
    padding: 2rem 1rem;
}

/* ヘッダーロゴ */
.site-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
    flex-wrap: wrap;
}

.site-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.site-header h1 {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1.3;
    display: flex;
    align-items: center;
    height: auto;
    word-break: break-word;
    text-align: center;
}

/* アップロードエリア */
.upload-area {
    border: 3px dashed #dee2e6;
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #0d6efd;
    background-color: #f8f9fa;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #0d6efd;
    background-color: #e7f0ff;
}

/* 特徴カード */
.feature-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    height: 100%;
    margin-bottom: 1rem;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2.5rem;
    color: #0d6efd;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0;
}

/* エディター部分 */
.editor-section {
    background: #f8f9fa;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: none;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

/* キャンバスコンテナ */
.canvas-container {
    background: transparent;
    border: none;
    border-radius: 8px;
    margin: 1.5rem 1rem 1rem;
    width: calc(100% - 2rem) !important;
    height: auto !important;
    aspect-ratio: 16/9;
    min-height: 400px !important;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box !important;
}

.canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border: none !important;
}

/* 編集図形のスタイル */
.canvas-container .shape-control {
    border: 2px solid #0d6efd;
    background-color: rgba(13, 110, 253, 0.2);
}

.canvas-container .shape-control:hover {
    border-color: #0a58ca;
    background-color: rgba(13, 110, 253, 0.3);
}

/* 回転・リサイズハンドルのスタイル */
.canvas-container .corner {
    background-color: #ffffff !important;
    border: 2px solid #0d6efd !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
}

.canvas-container .corner:hover {
    background-color: #f8f9fa !important;
    border-color: #0a58ca !important;
    transform: scale(1.1);
}

/* デバッグ・ステータス情報エリア */
.debug-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin: 0.5rem 1rem 1rem;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    height: 80px;
    overflow-y: auto;
    color: #333;
}

.status-info {
    background: #e7f0ff;
    border: 1px solid #b6d4fe;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 1rem;
    font-size: 0.9rem;
    color: #084298;
    line-height: 1.4;
}

/* ツールバー */
.toolbar {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* アスペクト比セレクター */
.aspect-ratio-selector {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

/* ファイル形式セレクター */
.file-format-selector {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

/* 切り抜きサイズセレクター */
.crop-size-selector {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

.size-input {
    width: 70px;
    text-align: center;
}

.lock-icon {
    font-size: 1.2rem;
    color: #6c757d;
    cursor: pointer;
    user-select: none;
}

/* 「画像選択に戻る」ボタンのゴーストスタイル */
.back-to-select-button {
    background-color: transparent !important;
    color: #6c757d !important;
    border: 1px solid #dee2e6 !important;
    font-weight: normal !important;
}

.back-to-select-button:hover {
    background-color: #f8f9fa !important;
    color: #495057 !important;
    border-color: #adb5bd !important;
}

/* ボタンのスタイル改善 */
.btn-group .btn {
    border-radius: 6px !important;
    margin: 0 2px;
    font-weight: 500;
}

.btn-group .btn:first-child {
    margin-left: 0;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

.btn-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.toolbar button {
    min-width: 100px;
    padding: 0.5rem 1rem;
}

.toolbar button.active {
    background-color: #0d6efd;
    color: #ffffff;
    border-color: #0d6efd;
}

/* アクションボタン */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 1rem;
    background: #ffffff;
    border-radius: 0 0 16px 16px;
}

/* 使い方ガイド */
.guide-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.step {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.step-number {
    background: #0d6efd;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

/* アクセシビリティ対応 */
.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

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

.feature-card, .step {
    animation: fadeIn 0.6s ease-out forwards;
}

/* ローディングスピナー */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    z-index: 1000;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    /* ヘッダー部分 */
    .site-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .site-header h1 {
        font-size: 1.5rem;
        line-height: 1.2;
        text-align: center;
        width: 100%;
    }
    
    /* 特徴カード */
    .feature-card {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .feature-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    /* コンテンツセクション */
    .content-section {
        padding: 0;
        margin-bottom: 2rem;
    }
    
    /* アップロードエリア */
    .upload-area {
        padding: 2rem 1rem;
    }
    
    /* キャンバス */
    .canvas-container {
        aspect-ratio: 4/3;
        min-height: 300px !important;
        margin: 0.5rem;
    }
    
    /* デバッグ情報 */
    .debug-info {
        height: 60px;
        margin: 0.5rem;
    }
    
    /* ツールバー */
    .toolbar {
        padding: 0.5rem;
    }
    
    .toolbar button {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
        min-width: 80px;
    }
    
    /* ガイドステップ */
    .guide-steps {
        gap: 2.5rem;
    }
    
    /* フッター */
    footer {
        padding: 2rem 1rem !important;
    }
}

/* 小さいスマホ向け調整 */
@media (max-width: 576px) {
    .toolbar .btn-group {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-buttons button {
        width: 100%;
    }
    
    .upload-area {
        padding: 1.5rem 1rem;
    }
    
    .site-logo {
        width: 40px;
        height: 40px;
    }
    
    .site-header h1 {
        font-size: 1.3rem;
    }
    
    .language-switcher {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .language-switcher .btn-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* 言語切り替えメニュー */
.language-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.language-switcher .btn-link {
    color: #333;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.language-switcher .dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

.language-switcher .dropdown-item.active {
    background-color: #0d6efd;
    color: #ffffff;
}

/* アラビア語用のRTLサポート */
[lang="ar"] {
    direction: rtl;
    text-align: right;
}

[lang="ar"] .site-header {
    flex-direction: row-reverse;
}

[lang="ar"] .toolbar,
[lang="ar"] .action-buttons {
    flex-direction: row-reverse;
}

/* 新機能用スタイル */
/* 操作ガイド */
.operation-guide {
    background: #e3f2fd;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
    margin-bottom: 1rem;
}

.guide-steps-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1976d2;
}

.guide-step {
    background: #ffffff;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid #bbdefb;
}

.guide-arrow {
    color: #1976d2;
    font-weight: bold;
}

/* アスペクト比セレクター */
.aspect-ratio-selector {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.aspect-ratio-selector .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    display: block;
}

.aspect-ratio-selector .btn-group-sm {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.aspect-ratio-selector .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ファイル形式セレクター */
.file-format-selector {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.file-format-selector .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    display: block;
}

.file-format-selector .btn-group-sm {
    display: flex;
    gap: 0.3rem;
}

.file-format-selector .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .guide-steps-inline {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .guide-arrow {
        transform: rotate(90deg);
    }
    
    .aspect-ratio-selector .btn-group-sm,
    .file-format-selector .btn-group-sm {
        justify-content: center;
    }
}