/* リセットとベース */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* コンテナ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ヘッダー */
.header {
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #4f46e5;
}

.logo svg {
    width: 28px;
    height: 28px;
}

/* 言語セレクター */
.lang-selector {
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    background-color: #f3f4f6;
}

.lang-btn.active {
    background-color: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

/* メイン */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* ドロップエリア */
.drop-area {
    background-color: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 2rem;
}

.drop-area:hover,
.drop-area.drag-over {
    border-color: #4f46e5;
    background-color: #f0f9ff;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.drop-text {
    font-size: 1.125rem;
    color: #64748b;
}

/* エディターエリア */
.editor-area {
    background-color: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* ツールバー */
.toolbar {
    background-color: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid transparent;
    background-color: #fff;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.tool-btn:hover {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
}

.tool-btn.active {
    background-color: #4f46e5;
    color: #fff;
}

.tool-btn svg {
    width: 20px;
    height: 20px;
}

.tool-btn span {
    font-size: 0.75rem;
}

.tool-btn.secondary {
    background-color: #f3f4f6;
}

.tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-separator {
    width: 1px;
    height: 40px;
    background-color: #e5e7eb;
    margin: 0 0.5rem;
}

/* キャンバスコンテナ */
.canvas-container {
    position: relative;
    padding: 2rem;
    background-color: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    overflow: auto;
}

#canvas {
    max-width: 100%;
    background-color: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: crosshair;
}

/* リサイズハンドル */
.resize-handles {
    position: absolute;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #4f46e5;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: all;
    cursor: pointer;
}

.resize-handle[data-direction="nw"] {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.resize-handle[data-direction="ne"] {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.resize-handle[data-direction="sw"] {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.resize-handle[data-direction="se"] {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

/* ツールオプション */
.tool-options {
    background-color: #f8fafc;
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
}

.option-group input[type="color"] {
    width: 40px;
    height: 40px;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    cursor: pointer;
}

.option-group input[type="range"] {
    width: 120px;
}

.option-group span {
    font-size: 0.875rem;
    color: #64748b;
    min-width: 30px;
    text-align: center;
}

/* アクションボタン */
.action-buttons {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background-color: #f8fafc;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #4f46e5;
    color: #fff;
}

.btn-primary:hover {
    background-color: #4338ca;
}

.btn-secondary {
    background-color: #fff;
    color: #475569;
    border: 1px solid #e5e7eb;
}

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

/* フッター */
.footer {
    background-color: #1e293b;
    color: #94a3b8;
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.875rem;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .toolbar {
        justify-content: center;
    }
    
    .tool-btn {
        min-width: auto;
        padding: 0.5rem;
    }
    
    .tool-btn span {
        display: none;
    }
    
    .tool-options {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

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

.editor-area {
    animation: fadeIn 0.3s ease-out;
}

/* カスタムスクロールバー */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}