.image-to-pdf-wrapper {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.converter-header {
    text-align: center;
    margin-bottom: 30px;
}

.converter-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* サイドバーを左に配置 */
.converter-container .sidebar {
    order: 1;
}

.converter-container .main-content {
    order: 2;
}

.converter-header h2 {
    font-size: 2.5rem;
    color: #2d3748;
    margin-bottom: 1rem;
    font-weight: 600;
    background: #fff;
}

.converter-header p {
    color: #4a5568;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* サイドバースタイル */
.sidebar {
    width: 380px;
    min-width: 380px;
    background: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-height: 85vh;
    overflow-y: auto;
    position: sticky;
    top: 20px;
}

.sidebar-section {
    padding: 20px;
}

.sidebar-section.upload-section {
    border-bottom: 2px solid #e2e8f0;
}

.sidebar h3 {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 15px;
    font-weight: 600;
}

/* ドラッグ&ドロップゾーン */
.drop-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 15px;
}

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

.drop-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.drop-zone-text {
    color: #4f46e5;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.drop-zone-subtext {
    color: #64748b;
    font-size: 0.85rem;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-select-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4f46e5;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: none;
}

.file-select-button:hover {
    background-color: #4338ca;
}

.sidebar-info {
    background: #f0f9ff;
    border-left: 4px solid #3b82f6;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #1e40af;
}

.sidebar-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.action-button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.action-button.add-more {
    background-color: #10b981;
    color: white;
}

.action-button.add-more:hover {
    background-color: #059669;
}

.action-button.reset {
    background-color: #ef4444;
    color: white;
}

.action-button.reset:hover {
    background-color: #dc2626;
}

.image-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.image-list-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: move;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.image-list-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e0;
    transform: translateX(5px);
}

.image-list-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.image-list-item.drag-over {
    border-color: #4f46e5;
    background: #eef2ff;
}

.image-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #4f46e5;
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.image-list-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.image-name {
    flex: 1;
    font-size: 0.85rem;
    color: #475569;
    word-break: break-all;
    line-height: 1.3;
    padding-right: 30px;
}

.drag-handle {
    font-size: 1.2rem;
    color: #94a3b8;
    cursor: grab;
    flex-shrink: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

.delete-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.2s ease;
    padding: 0;
}

.delete-button:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.image-count {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 15px;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 6px;
}

/* メインコンテンツエリア */
.main-content {
    flex: 1;
    min-width: 0;
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    position: relative;
}

#convert-to-pdf-button {
    background-color: #4f46e5;
    color: white;
    min-width: 150px;
}

#convert-to-pdf-button:hover:not(:disabled) {
    background-color: #4338ca;
}

#convert-to-pdf-button:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ローディングアニメーション */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* PDFレイアウトオプション */
.pdf-layout-options {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pdf-layout-options h3 {
    font-size: 1.1rem;
    color: #2d3748;
    margin-bottom: 15px;
    font-weight: 600;
}

.layout-option {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.layout-option:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.layout-option.selected {
    background: #eef2ff;
    border-color: #4f46e5;
}

.layout-option input[type="radio"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4f46e5;
}

.layout-option-content {
    flex: 1;
}

.layout-option-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.layout-option-description {
    font-size: 0.85rem;
    color: #64748b;
}

/* プログレスバー */
.progress-container {
    display: none;
    margin-top: 15px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 15px;
}

.progress-container.active {
    display: block;
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 500;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 40px;
    padding: 20px;
}

.image-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.image-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px 12px 0 0;
    max-height: 300px;
    object-fit: cover;
}

.image-label {
    display: block;
    padding: 16px;
    text-decoration: none;
    color: #4f46e5;
    font-weight: 500;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 0.9rem;
    text-align: left;
    word-break: break-all;
}

@media (max-width: 1024px) {
    .converter-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
        position: static;
        max-height: 600px;
        order: 1;
    }
    
    .main-content {
        width: 100%;
        order: 2;
    }
}

@media (max-width: 768px) {
    .converter-header h2 {
        font-size: 2rem;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
    
    .sidebar {
        max-height: 500px;
    }
}
